@caspian2026/agent-sdk 0.0.25 → 0.0.26

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 (362) hide show
  1. package/dist/gateway/index.js +98 -22
  2. package/dist/gateway/worker.js +86 -41
  3. package/dist/sdk/query.cjs +2 -362
  4. package/dist/sdk/query.js +2 -367
  5. package/package.json +4 -6
  6. package/dist/chunk-04n4fe72.js +0 -107
  7. package/dist/chunk-04ys66ej.js +0 -344
  8. package/dist/chunk-07069jq1.js +0 -30
  9. package/dist/chunk-0731m51q.js +0 -8
  10. package/dist/chunk-086x4ct4.js +0 -26
  11. package/dist/chunk-0btqb97n.js +0 -295
  12. package/dist/chunk-0paqc2yw.js +0 -15
  13. package/dist/chunk-0r1rjydx.js +0 -145
  14. package/dist/chunk-0r5bb9j4.js +0 -477
  15. package/dist/chunk-0t81d427.js +0 -41
  16. package/dist/chunk-0teq2mz0.js +0 -420
  17. package/dist/chunk-0vkfrmqm.js +0 -690
  18. package/dist/chunk-0vp3wfab.js +0 -12
  19. package/dist/chunk-0warp8dx.js +0 -253
  20. package/dist/chunk-0xjaqda8.js +0 -1124
  21. package/dist/chunk-10gzv316.js +0 -62
  22. package/dist/chunk-11pq9n08.js +0 -168
  23. package/dist/chunk-1ae3nt9j.js +0 -31
  24. package/dist/chunk-1fmb0njn.js +0 -396
  25. package/dist/chunk-1gx78081.js +0 -66
  26. package/dist/chunk-1h2famwb.js +0 -49
  27. package/dist/chunk-1ng8xwxz.js +0 -276
  28. package/dist/chunk-1v7jp29h.js +0 -206
  29. package/dist/chunk-1xxy5zhb.js +0 -673
  30. package/dist/chunk-20b73w7w.js +0 -117
  31. package/dist/chunk-20qxd83a.js +0 -1161
  32. package/dist/chunk-2239ny9q.js +0 -90
  33. package/dist/chunk-22d4rnef.js +0 -226
  34. package/dist/chunk-26wtxbdc.js +0 -13870
  35. package/dist/chunk-27225bjh.js +0 -618
  36. package/dist/chunk-2b0e32an.js +0 -5822
  37. package/dist/chunk-2bfa9w1y.js +0 -323
  38. package/dist/chunk-2epq04w1.js +0 -63
  39. package/dist/chunk-2fwze72g.js +0 -24
  40. package/dist/chunk-2gzv8nrw.js +0 -205
  41. package/dist/chunk-2mexte1r.js +0 -349
  42. package/dist/chunk-2mzaqh5g.js +0 -338
  43. package/dist/chunk-2tb6mzfc.js +0 -81
  44. package/dist/chunk-2xq0g43w.js +0 -558
  45. package/dist/chunk-334aeqg9.js +0 -90
  46. package/dist/chunk-34jx4rjd.js +0 -995
  47. package/dist/chunk-35w5nhex.js +0 -132
  48. package/dist/chunk-3c25bcsw.js +0 -17
  49. package/dist/chunk-3eaxj8dg.js +0 -151
  50. package/dist/chunk-3fdgrwd2.js +0 -111
  51. package/dist/chunk-3jw0r58d.js +0 -121
  52. package/dist/chunk-3mgywd32.js +0 -8
  53. package/dist/chunk-3nk79af8.js +0 -8
  54. package/dist/chunk-3vy1jt9p.js +0 -1010
  55. package/dist/chunk-3x78pd4j.js +0 -153
  56. package/dist/chunk-47x3dsmn.js +0 -95
  57. package/dist/chunk-49pqt48n.js +0 -108
  58. package/dist/chunk-4f7m9fjw.js +0 -317
  59. package/dist/chunk-4jm600zv.js +0 -13
  60. package/dist/chunk-4k9d7gxv.js +0 -118
  61. package/dist/chunk-4net8san.js +0 -155
  62. package/dist/chunk-4pbx3g7s.js +0 -26
  63. package/dist/chunk-4v125j4z.js +0 -58
  64. package/dist/chunk-4vxkv5vz.js +0 -1438
  65. package/dist/chunk-51fqpjy3.js +0 -121
  66. package/dist/chunk-52e64f2h.js +0 -439
  67. package/dist/chunk-52e9mdjv.js +0 -684
  68. package/dist/chunk-55raexh7.js +0 -14358
  69. package/dist/chunk-59pq5122.js +0 -269
  70. package/dist/chunk-5bsj67v1.js +0 -349
  71. package/dist/chunk-5ccdsxgy.js +0 -74
  72. package/dist/chunk-5ekyhb1w.js +0 -422
  73. package/dist/chunk-5gcqdn8x.js +0 -867
  74. package/dist/chunk-5h5kx2jd.js +0 -34
  75. package/dist/chunk-5hf3werb.js +0 -193
  76. package/dist/chunk-5n1jc02d.js +0 -87
  77. package/dist/chunk-5wfxvxm8.js +0 -127
  78. package/dist/chunk-5wjebwmn.js +0 -89
  79. package/dist/chunk-5z28bqne.js +0 -6748
  80. package/dist/chunk-5zwsxpjn.js +0 -671
  81. package/dist/chunk-60phw466.js +0 -29
  82. package/dist/chunk-64c1avct.js +0 -13
  83. package/dist/chunk-64r16v22.js +0 -162
  84. package/dist/chunk-65t1r7zs.js +0 -418
  85. package/dist/chunk-66zry909.js +0 -11
  86. package/dist/chunk-67hxjjgc.js +0 -731
  87. package/dist/chunk-68ffk5qa.js +0 -14
  88. package/dist/chunk-69dr6rrd.js +0 -177
  89. package/dist/chunk-69n11zng.js +0 -436
  90. package/dist/chunk-6dj5t602.js +0 -341
  91. package/dist/chunk-6dngjwkh.js +0 -63
  92. package/dist/chunk-6dp8sz55.js +0 -3561
  93. package/dist/chunk-6hqgg0sv.js +0 -103
  94. package/dist/chunk-6nsd9606.js +0 -790
  95. package/dist/chunk-6p0hbwz3.js +0 -65
  96. package/dist/chunk-6ywdv5vg.js +0 -97
  97. package/dist/chunk-6zc758qw.js +0 -640
  98. package/dist/chunk-7aw745vx.js +0 -40175
  99. package/dist/chunk-7fxaphbq.js +0 -116
  100. package/dist/chunk-7sgtxrsc.js +0 -1059
  101. package/dist/chunk-7wm5s02e.js +0 -216
  102. package/dist/chunk-7xdk4109.js +0 -442
  103. package/dist/chunk-7xyswgjh.js +0 -8
  104. package/dist/chunk-83hfzbx3.js +0 -10
  105. package/dist/chunk-87m69h0v.js +0 -219
  106. package/dist/chunk-8g5pe1gr.js +0 -37
  107. package/dist/chunk-8jbw0fnf.js +0 -167
  108. package/dist/chunk-8jf9se66.js +0 -321
  109. package/dist/chunk-8p65embj.js +0 -875
  110. package/dist/chunk-8qrmaff1.js +0 -2669
  111. package/dist/chunk-8r975mwc.js +0 -93
  112. package/dist/chunk-8yhf030a.js +0 -69
  113. package/dist/chunk-93emz367.js +0 -107
  114. package/dist/chunk-948mn975.js +0 -460
  115. package/dist/chunk-99chkt7r.js +0 -54
  116. package/dist/chunk-9f7c1hzz.js +0 -50
  117. package/dist/chunk-9fk9ps1g.js +0 -178
  118. package/dist/chunk-9rh0k0aq.js +0 -90
  119. package/dist/chunk-9x5zgy22.js +0 -12
  120. package/dist/chunk-a0k2vj5b.js +0 -460
  121. package/dist/chunk-a0m57ssq.js +0 -325
  122. package/dist/chunk-a0nsmmz1.js +0 -133
  123. package/dist/chunk-a25jh1v4.js +0 -105
  124. package/dist/chunk-a4j5ekv0.js +0 -83
  125. package/dist/chunk-a8k3zf58.js +0 -313
  126. package/dist/chunk-ah0zarbq.js +0 -260
  127. package/dist/chunk-ase86y73.js +0 -15
  128. package/dist/chunk-b0kf00ff.js +0 -637
  129. package/dist/chunk-b1kcd3ss.js +0 -27
  130. package/dist/chunk-b8kcqqds.js +0 -93
  131. package/dist/chunk-bg4x9ex0.js +0 -21
  132. package/dist/chunk-bh5zqvyc.js +0 -36
  133. package/dist/chunk-bqrkfekw.js +0 -267
  134. package/dist/chunk-brjd9zmk.js +0 -42
  135. package/dist/chunk-byfawrfx.js +0 -121
  136. package/dist/chunk-c6sjhj89.js +0 -1284
  137. package/dist/chunk-c7e5yv0q.js +0 -212
  138. package/dist/chunk-c7jwbe76.js +0 -29030
  139. package/dist/chunk-cb5v8w7k.js +0 -289
  140. package/dist/chunk-cdef9v7b.js +0 -27
  141. package/dist/chunk-cdz5yb0r.js +0 -57
  142. package/dist/chunk-cgfdkzhb.js +0 -12
  143. package/dist/chunk-cgqw4x5z.js +0 -155
  144. package/dist/chunk-cnsj3vq2.js +0 -35
  145. package/dist/chunk-cqxm7ggc.js +0 -123
  146. package/dist/chunk-cxrktb5g.js +0 -51
  147. package/dist/chunk-d089t7dk.js +0 -312
  148. package/dist/chunk-d1z934cp.js +0 -71
  149. package/dist/chunk-d4mdda98.js +0 -94
  150. package/dist/chunk-d7xw8v91.js +0 -332
  151. package/dist/chunk-dc06c3rw.js +0 -1154
  152. package/dist/chunk-ddsjkqs4.js +0 -39
  153. package/dist/chunk-dfzkwynj.js +0 -5368
  154. package/dist/chunk-dnmp7s85.js +0 -20
  155. package/dist/chunk-dqqwjkv3.js +0 -8583
  156. package/dist/chunk-dt2mr4vf.js +0 -2962
  157. package/dist/chunk-dztm97gg.js +0 -150
  158. package/dist/chunk-e0abab5b.js +0 -445
  159. package/dist/chunk-e0ragz46.js +0 -209386
  160. package/dist/chunk-e9w9zc0g.js +0 -392
  161. package/dist/chunk-ebwskmsr.js +0 -107
  162. package/dist/chunk-efztk52j.js +0 -114
  163. package/dist/chunk-ehd8wacx.js +0 -40
  164. package/dist/chunk-ehtwnxpg.js +0 -1591
  165. package/dist/chunk-eqp1rfft.js +0 -17
  166. package/dist/chunk-etdt1xz3.js +0 -19
  167. package/dist/chunk-eva785x8.js +0 -88
  168. package/dist/chunk-ewadzrm8.js +0 -103
  169. package/dist/chunk-f2ajmcav.js +0 -92
  170. package/dist/chunk-fajg8x36.js +0 -8158
  171. package/dist/chunk-fbv4apne.js +0 -51
  172. package/dist/chunk-fcynwjpm.js +0 -1072
  173. package/dist/chunk-fev86f95.js +0 -1052
  174. package/dist/chunk-feyzykye.js +0 -10
  175. package/dist/chunk-ff85rwvc.js +0 -180
  176. package/dist/chunk-fk6ktvg2.js +0 -275
  177. package/dist/chunk-fqak69ft.js +0 -458
  178. package/dist/chunk-fqwas4jk.js +0 -281
  179. package/dist/chunk-fs35fdpj.js +0 -439
  180. package/dist/chunk-fvr3f9s3.js +0 -55
  181. package/dist/chunk-fyc5fepv.js +0 -10
  182. package/dist/chunk-g2g9cwt9.js +0 -54
  183. package/dist/chunk-g4znz46v.js +0 -2335
  184. package/dist/chunk-g5ts4e6k.js +0 -697
  185. package/dist/chunk-g6een9wr.js +0 -654
  186. package/dist/chunk-g7cmtx8r.js +0 -77
  187. package/dist/chunk-g9f19ttm.js +0 -15
  188. package/dist/chunk-gc7ap41t.js +0 -516
  189. package/dist/chunk-gdwdqewd.js +0 -19
  190. package/dist/chunk-gg14h3n4.js +0 -131
  191. package/dist/chunk-gg55fns0.js +0 -6440
  192. package/dist/chunk-gq7zab4e.js +0 -418
  193. package/dist/chunk-gydw3qy3.js +0 -169
  194. package/dist/chunk-gz1e8y1w.js +0 -33
  195. package/dist/chunk-h19r628d.js +0 -91
  196. package/dist/chunk-h2k8mt3z.js +0 -329
  197. package/dist/chunk-h9n54swm.js +0 -27
  198. package/dist/chunk-hakdhagh.js +0 -16606
  199. package/dist/chunk-hc2chp3g.js +0 -308
  200. package/dist/chunk-hemcv9t7.js +0 -153
  201. package/dist/chunk-hm62ntv3.js +0 -20
  202. package/dist/chunk-hmq09ytj.js +0 -100
  203. package/dist/chunk-hmv4hhqt.js +0 -2718
  204. package/dist/chunk-hwfknpxv.js +0 -39
  205. package/dist/chunk-j5bth84e.js +0 -97
  206. package/dist/chunk-j64ga6ta.js +0 -8035
  207. package/dist/chunk-j6v3w4yf.js +0 -244
  208. package/dist/chunk-jc29d2nm.js +0 -130
  209. package/dist/chunk-jd32zbps.js +0 -15
  210. package/dist/chunk-jd4sx4wh.js +0 -594
  211. package/dist/chunk-jha8n8b9.js +0 -33118
  212. package/dist/chunk-jj71qx7m.js +0 -122
  213. package/dist/chunk-jka9vpak.js +0 -114
  214. package/dist/chunk-jkf6ayv0.js +0 -32
  215. package/dist/chunk-jpz6t2tt.js +0 -61
  216. package/dist/chunk-jqt3sw12.js +0 -9114
  217. package/dist/chunk-jswd1q63.js +0 -101
  218. package/dist/chunk-jtc4aa2y.js +0 -1543
  219. package/dist/chunk-jyx3h86z.js +0 -635
  220. package/dist/chunk-jzthz1bx.js +0 -15
  221. package/dist/chunk-k0p9w03v.js +0 -4957
  222. package/dist/chunk-k6x3s7x5.js +0 -211
  223. package/dist/chunk-k7kmvnnx.js +0 -942
  224. package/dist/chunk-k8vp0atq.js +0 -2331
  225. package/dist/chunk-k9vm6x6z.js +0 -257
  226. package/dist/chunk-kb1edvhs.js +0 -120
  227. package/dist/chunk-kbhbe33q.js +0 -113
  228. package/dist/chunk-kgcgpp7z.js +0 -140
  229. package/dist/chunk-kvywbvqs.js +0 -261
  230. package/dist/chunk-kwekc97v.js +0 -18
  231. package/dist/chunk-kwyk9zp1.js +0 -74
  232. package/dist/chunk-ky1z78ve.js +0 -119
  233. package/dist/chunk-mcws22k3.js +0 -42
  234. package/dist/chunk-mr2z79r3.js +0 -1385
  235. package/dist/chunk-mst9nmns.js +0 -642
  236. package/dist/chunk-mswx2nma.js +0 -103
  237. package/dist/chunk-n1e3fjpz.js +0 -266
  238. package/dist/chunk-n6vjp9yg.js +0 -138
  239. package/dist/chunk-n84tqtvv.js +0 -120
  240. package/dist/chunk-n8ssddbw.js +0 -105
  241. package/dist/chunk-na35whkd.js +0 -227
  242. package/dist/chunk-netzwgv1.js +0 -154
  243. package/dist/chunk-ng7j0yy1.js +0 -100
  244. package/dist/chunk-nmgj86tt.js +0 -24
  245. package/dist/chunk-ns7x6xam.js +0 -22820
  246. package/dist/chunk-p7vkh4wx.js +0 -15
  247. package/dist/chunk-p8na2wwp.js +0 -14
  248. package/dist/chunk-pe3rkfp2.js +0 -74
  249. package/dist/chunk-pf0152j3.js +0 -40
  250. package/dist/chunk-pgtnj1mt.js +0 -705
  251. package/dist/chunk-ppwjyveh.js +0 -8
  252. package/dist/chunk-pq5qp2y4.js +0 -388
  253. package/dist/chunk-pqqxdk5f.js +0 -543
  254. package/dist/chunk-ps49ymvj.js +0 -43
  255. package/dist/chunk-pws8gq7m.js +0 -7422
  256. package/dist/chunk-pwwa7s62.js +0 -11
  257. package/dist/chunk-pyq0fabn.js +0 -860
  258. package/dist/chunk-q0p1m40t.js +0 -79
  259. package/dist/chunk-q0vhv550.js +0 -393
  260. package/dist/chunk-q7r0kt08.js +0 -1809
  261. package/dist/chunk-qajrkk97.js +0 -298
  262. package/dist/chunk-qatfdxvd.js +0 -34
  263. package/dist/chunk-qb6k2afy.js +0 -153
  264. package/dist/chunk-qg2qgx8h.js +0 -266
  265. package/dist/chunk-qkczt8cr.js +0 -24
  266. package/dist/chunk-qnfx3qtx.js +0 -617
  267. package/dist/chunk-qp2qdcda.js +0 -100
  268. package/dist/chunk-qtwgzej9.js +0 -85
  269. package/dist/chunk-r1dh0ymt.js +0 -91
  270. package/dist/chunk-r36xvgvv.js +0 -407
  271. package/dist/chunk-r48he8g3.js +0 -251
  272. package/dist/chunk-r63tqmtk.js +0 -146
  273. package/dist/chunk-rbdd3q5k.js +0 -101
  274. package/dist/chunk-rmbbmd3s.js +0 -68
  275. package/dist/chunk-rn0v1hk8.js +0 -34
  276. package/dist/chunk-rnxctq9p.js +0 -1646
  277. package/dist/chunk-rrs2mchs.js +0 -183
  278. package/dist/chunk-rtrybvnp.js +0 -209
  279. package/dist/chunk-rw2wkn45.js +0 -494
  280. package/dist/chunk-s4kzkdhd.js +0 -847
  281. package/dist/chunk-s7a0zn7b.js +0 -55
  282. package/dist/chunk-s8gy4ky9.js +0 -122
  283. package/dist/chunk-s8kj6ajy.js +0 -32
  284. package/dist/chunk-sag785ad.js +0 -283
  285. package/dist/chunk-scqjyben.js +0 -174
  286. package/dist/chunk-sd36yzx8.js +0 -954
  287. package/dist/chunk-sdtqm0nm.js +0 -374
  288. package/dist/chunk-sg60xg0x.js +0 -52
  289. package/dist/chunk-sgpmpn90.js +0 -35
  290. package/dist/chunk-sh02d2qn.js +0 -38
  291. package/dist/chunk-sz9y6z13.js +0 -61
  292. package/dist/chunk-szj5wvdy.js +0 -28
  293. package/dist/chunk-t29a6zb5.js +0 -45
  294. package/dist/chunk-t2b49hcf.js +0 -87
  295. package/dist/chunk-t2wqdppz.js +0 -445
  296. package/dist/chunk-t4khqff1.js +0 -16
  297. package/dist/chunk-t70t2gne.js +0 -121
  298. package/dist/chunk-t9p85zff.js +0 -24
  299. package/dist/chunk-tkrstmwz.js +0 -94
  300. package/dist/chunk-tnyb4exc.js +0 -74
  301. package/dist/chunk-tpn8jsvw.js +0 -71
  302. package/dist/chunk-tt7x5j1q.js +0 -111
  303. package/dist/chunk-tw1p628z.js +0 -984
  304. package/dist/chunk-twvdafcz.js +0 -528
  305. package/dist/chunk-tzwjafgn.js +0 -24
  306. package/dist/chunk-v140t8ay.js +0 -152
  307. package/dist/chunk-v1kzp02e.js +0 -785
  308. package/dist/chunk-v4t6dyyh.js +0 -9076
  309. package/dist/chunk-v78fj8by.js +0 -145
  310. package/dist/chunk-v8kjswxt.js +0 -61
  311. package/dist/chunk-v9smspw2.js +0 -4301
  312. package/dist/chunk-vcfbjkk9.js +0 -201
  313. package/dist/chunk-ve167rcs.js +0 -148
  314. package/dist/chunk-vf612n57.js +0 -472
  315. package/dist/chunk-vhffyae8.js +0 -895
  316. package/dist/chunk-vkhrrvfq.js +0 -44
  317. package/dist/chunk-vybkmfhf.js +0 -91
  318. package/dist/chunk-vyjeh50y.js +0 -2149
  319. package/dist/chunk-w6m6trzq.js +0 -58
  320. package/dist/chunk-w9b6kngq.js +0 -234
  321. package/dist/chunk-wa8yn2p0.js +0 -2007
  322. package/dist/chunk-wanceff6.js +0 -2840
  323. package/dist/chunk-wcze2nea.js +0 -336
  324. package/dist/chunk-wgk9sxk7.js +0 -329
  325. package/dist/chunk-wnxcgfsd.js +0 -253
  326. package/dist/chunk-wyjerrr6.js +0 -565
  327. package/dist/chunk-wz9brkq5.js +0 -60
  328. package/dist/chunk-x47h283a.js +0 -56
  329. package/dist/chunk-x59j3x9c.js +0 -98
  330. package/dist/chunk-x6r4v44b.js +0 -8
  331. package/dist/chunk-x7fdwq3d.js +0 -33
  332. package/dist/chunk-x8d2ehd7.js +0 -19
  333. package/dist/chunk-xeb6075z.js +0 -3435
  334. package/dist/chunk-xfw2pxwd.js +0 -223
  335. package/dist/chunk-xh06jc72.js +0 -200
  336. package/dist/chunk-xhfmdq1y.js +0 -147
  337. package/dist/chunk-xkwyg1d2.js +0 -195
  338. package/dist/chunk-xv3era3s.js +0 -8
  339. package/dist/chunk-xyapc58m.js +0 -87
  340. package/dist/chunk-xzgnc76g.js +0 -107
  341. package/dist/chunk-y1784krc.js +0 -19
  342. package/dist/chunk-y4ca9kqz.js +0 -3830
  343. package/dist/chunk-y9bhjjdz.js +0 -145
  344. package/dist/chunk-yb3bxv3w.js +0 -30
  345. package/dist/chunk-yddek6xk.js +0 -146
  346. package/dist/chunk-ypaq3d12.js +0 -4265
  347. package/dist/chunk-yq8z040g.js +0 -111
  348. package/dist/chunk-yqs481qq.js +0 -1163
  349. package/dist/chunk-ys9a9c9h.js +0 -105
  350. package/dist/chunk-yyex5gsf.js +0 -269
  351. package/dist/chunk-yzn396hn.js +0 -89
  352. package/dist/chunk-z2dp53wn.js +0 -17
  353. package/dist/chunk-zay4xp4n.js +0 -251
  354. package/dist/chunk-zc8bwy57.js +0 -212
  355. package/dist/chunk-zhx88cfx.js +0 -97
  356. package/dist/chunk-zkh6f4ct.js +0 -385
  357. package/dist/chunk-zq56gcca.js +0 -206
  358. package/dist/chunk-zrkefd22.js +0 -490
  359. package/dist/chunk-zs5p0yq1.js +0 -1030
  360. package/dist/chunk-zxh62ved.js +0 -31
  361. package/dist/chunk-zzm33q8x.js +0 -8
  362. package/dist/cli.js +0 -220
@@ -1,731 +0,0 @@
1
- // @bun
2
- import {
3
- getCurrentProjectConfig,
4
- getGlobalConfig,
5
- init_config,
6
- init_file,
7
- isDirEmpty,
8
- saveCurrentProjectConfig,
9
- saveGlobalConfig
10
- } from "./chunk-2b0e32an.js";
11
- import {
12
- addItemToJSONCArray,
13
- init_json,
14
- safeParseJSONC
15
- } from "./chunk-rnxctq9p.js";
16
- import {
17
- env,
18
- init_env
19
- } from "./chunk-5ekyhb1w.js";
20
- import {
21
- color,
22
- init_source,
23
- init_src,
24
- source_default,
25
- supportsHyperlinks
26
- } from "./chunk-c7jwbe76.js";
27
- import {
28
- execFileNoThrow,
29
- init_execFileNoThrow
30
- } from "./chunk-64r16v22.js";
31
- import {
32
- getCwd,
33
- init_cwd
34
- } from "./chunk-s8kj6ajy.js";
35
- import {
36
- getFsImplementation,
37
- getPlatform,
38
- init_debug,
39
- init_errors,
40
- init_fsOperations,
41
- init_log,
42
- init_platform,
43
- init_slowOperations,
44
- isENOENT,
45
- isFsInaccessible,
46
- jsonParse,
47
- jsonStringify,
48
- logError
49
- } from "./chunk-gg55fns0.js";
50
- import {
51
- init_memoize,
52
- memoize_default
53
- } from "./chunk-vf612n57.js";
54
- import {
55
- __esm
56
- } from "./chunk-qp2qdcda.js";
57
-
58
- // src/projectOnboardingState.ts
59
- import { join } from "path";
60
- function getSteps() {
61
- const hasClaudeMd = getFsImplementation().existsSync(join(getCwd(), "CLAUDE.md"));
62
- const isWorkspaceDirEmpty = isDirEmpty(getCwd());
63
- return [
64
- {
65
- key: "workspace",
66
- text: "Ask Claude to create a new app or clone a repository",
67
- isComplete: false,
68
- isCompletable: true,
69
- isEnabled: isWorkspaceDirEmpty
70
- },
71
- {
72
- key: "claudemd",
73
- text: "Run /init to create a CLAUDE.md file with instructions for Claude",
74
- isComplete: hasClaudeMd,
75
- isCompletable: true,
76
- isEnabled: !isWorkspaceDirEmpty
77
- }
78
- ];
79
- }
80
- function isProjectOnboardingComplete() {
81
- return getSteps().filter(({ isCompletable, isEnabled }) => isCompletable && isEnabled).every(({ isComplete }) => isComplete);
82
- }
83
- function maybeMarkProjectOnboardingComplete() {
84
- if (getCurrentProjectConfig().hasCompletedProjectOnboarding) {
85
- return;
86
- }
87
- if (isProjectOnboardingComplete()) {
88
- saveCurrentProjectConfig((current) => ({
89
- ...current,
90
- hasCompletedProjectOnboarding: true
91
- }));
92
- }
93
- }
94
- function incrementProjectOnboardingSeenCount() {
95
- saveCurrentProjectConfig((current) => ({
96
- ...current,
97
- projectOnboardingSeenCount: current.projectOnboardingSeenCount + 1
98
- }));
99
- }
100
- var shouldShowProjectOnboarding;
101
- var init_projectOnboardingState = __esm(() => {
102
- init_memoize();
103
- init_config();
104
- init_cwd();
105
- init_file();
106
- init_fsOperations();
107
- shouldShowProjectOnboarding = memoize_default(() => {
108
- const projectConfig = getCurrentProjectConfig();
109
- if (projectConfig.hasCompletedProjectOnboarding || projectConfig.projectOnboardingSeenCount >= 4 || process.env.IS_DEMO) {
110
- return false;
111
- }
112
- return !isProjectOnboardingComplete();
113
- });
114
- });
115
-
116
- // src/utils/appleTerminalBackup.ts
117
- import { stat } from "fs/promises";
118
- import { homedir } from "os";
119
- import { join as join2 } from "path";
120
- function markTerminalSetupInProgress(backupPath) {
121
- saveGlobalConfig((current) => ({
122
- ...current,
123
- appleTerminalSetupInProgress: true,
124
- appleTerminalBackupPath: backupPath
125
- }));
126
- }
127
- function markTerminalSetupComplete() {
128
- saveGlobalConfig((current) => ({
129
- ...current,
130
- appleTerminalSetupInProgress: false
131
- }));
132
- }
133
- function getTerminalRecoveryInfo() {
134
- const config = getGlobalConfig();
135
- return {
136
- inProgress: config.appleTerminalSetupInProgress ?? false,
137
- backupPath: config.appleTerminalBackupPath || null
138
- };
139
- }
140
- function getTerminalPlistPath() {
141
- return join2(homedir(), "Library", "Preferences", "com.apple.Terminal.plist");
142
- }
143
- async function backupTerminalPreferences() {
144
- const terminalPlistPath = getTerminalPlistPath();
145
- const backupPath = `${terminalPlistPath}.bak`;
146
- try {
147
- const { code } = await execFileNoThrow("defaults", [
148
- "export",
149
- "com.apple.Terminal",
150
- terminalPlistPath
151
- ]);
152
- if (code !== 0) {
153
- return null;
154
- }
155
- try {
156
- await stat(terminalPlistPath);
157
- } catch {
158
- return null;
159
- }
160
- await execFileNoThrow("defaults", [
161
- "export",
162
- "com.apple.Terminal",
163
- backupPath
164
- ]);
165
- markTerminalSetupInProgress(backupPath);
166
- return backupPath;
167
- } catch (error) {
168
- logError(error);
169
- return null;
170
- }
171
- }
172
- async function checkAndRestoreTerminalBackup() {
173
- const { inProgress, backupPath } = getTerminalRecoveryInfo();
174
- if (!inProgress) {
175
- return { status: "no_backup" };
176
- }
177
- if (!backupPath) {
178
- markTerminalSetupComplete();
179
- return { status: "no_backup" };
180
- }
181
- try {
182
- await stat(backupPath);
183
- } catch {
184
- markTerminalSetupComplete();
185
- return { status: "no_backup" };
186
- }
187
- try {
188
- const { code } = await execFileNoThrow("defaults", [
189
- "import",
190
- "com.apple.Terminal",
191
- backupPath
192
- ]);
193
- if (code !== 0) {
194
- return { status: "failed", backupPath };
195
- }
196
- await execFileNoThrow("killall", ["cfprefsd"]);
197
- markTerminalSetupComplete();
198
- return { status: "restored" };
199
- } catch (restoreError) {
200
- logError(new Error(`Failed to restore Terminal.app settings with: ${restoreError}`));
201
- markTerminalSetupComplete();
202
- return { status: "failed", backupPath };
203
- }
204
- }
205
- var init_appleTerminalBackup = __esm(() => {
206
- init_config();
207
- init_execFileNoThrow();
208
- init_log();
209
- });
210
-
211
- // src/utils/completionCache.ts
212
- import { mkdir, readFile, writeFile } from "fs/promises";
213
- import { homedir as homedir2 } from "os";
214
- import { dirname, join as join3 } from "path";
215
- import { pathToFileURL } from "url";
216
- function detectShell() {
217
- const shell = process.env.SHELL || "";
218
- const home = homedir2();
219
- const claudeDir = join3(home, ".claude");
220
- if (shell.endsWith("/zsh") || shell.endsWith("/zsh.exe")) {
221
- const cacheFile = join3(claudeDir, "completion.zsh");
222
- return {
223
- name: "zsh",
224
- rcFile: join3(home, ".zshrc"),
225
- cacheFile,
226
- completionLine: `[[ -f "${cacheFile}" ]] && source "${cacheFile}"`,
227
- shellFlag: "zsh"
228
- };
229
- }
230
- if (shell.endsWith("/bash") || shell.endsWith("/bash.exe")) {
231
- const cacheFile = join3(claudeDir, "completion.bash");
232
- return {
233
- name: "bash",
234
- rcFile: join3(home, ".bashrc"),
235
- cacheFile,
236
- completionLine: `[ -f "${cacheFile}" ] && source "${cacheFile}"`,
237
- shellFlag: "bash"
238
- };
239
- }
240
- if (shell.endsWith("/fish") || shell.endsWith("/fish.exe")) {
241
- const xdg = process.env.XDG_CONFIG_HOME || join3(home, ".config");
242
- const cacheFile = join3(claudeDir, "completion.fish");
243
- return {
244
- name: "fish",
245
- rcFile: join3(xdg, "fish", "config.fish"),
246
- cacheFile,
247
- completionLine: `[ -f "${cacheFile}" ] && source "${cacheFile}"`,
248
- shellFlag: "fish"
249
- };
250
- }
251
- return null;
252
- }
253
- function formatPathLink(filePath) {
254
- if (!supportsHyperlinks()) {
255
- return filePath;
256
- }
257
- const fileUrl = pathToFileURL(filePath).href;
258
- return `\x1B]8;;${fileUrl}\x07${filePath}\x1B]8;;\x07`;
259
- }
260
- async function setupShellCompletion(theme) {
261
- const shell = detectShell();
262
- if (!shell) {
263
- return "";
264
- }
265
- try {
266
- await mkdir(dirname(shell.cacheFile), { recursive: true });
267
- } catch (e) {
268
- logError(e);
269
- return `${EOL}${color("warning", theme)(`Could not write ${shell.name} completion cache`)}${EOL}${source_default.dim(`Run manually: claude completion ${shell.shellFlag} > ${shell.cacheFile}`)}${EOL}`;
270
- }
271
- const claudeBin = process.argv[1] || "claude";
272
- const result = await execFileNoThrow(claudeBin, [
273
- "completion",
274
- shell.shellFlag,
275
- "--output",
276
- shell.cacheFile
277
- ]);
278
- if (result.code !== 0) {
279
- return `${EOL}${color("warning", theme)(`Could not generate ${shell.name} shell completions`)}${EOL}${source_default.dim(`Run manually: claude completion ${shell.shellFlag} > ${shell.cacheFile}`)}${EOL}`;
280
- }
281
- let existing = "";
282
- try {
283
- existing = await readFile(shell.rcFile, { encoding: "utf-8" });
284
- if (existing.includes("claude completion") || existing.includes(shell.cacheFile)) {
285
- return `${EOL}${color("success", theme)(`Shell completions updated for ${shell.name}`)}${EOL}${source_default.dim(`See ${formatPathLink(shell.rcFile)}`)}${EOL}`;
286
- }
287
- } catch (e) {
288
- if (!isENOENT(e)) {
289
- logError(e);
290
- return `${EOL}${color("warning", theme)(`Could not install ${shell.name} shell completions`)}${EOL}${source_default.dim(`Add this to ${formatPathLink(shell.rcFile)}:`)}${EOL}${source_default.dim(shell.completionLine)}${EOL}`;
291
- }
292
- }
293
- try {
294
- const configDir = dirname(shell.rcFile);
295
- await mkdir(configDir, { recursive: true });
296
- const separator = existing && !existing.endsWith(`
297
- `) ? `
298
- ` : "";
299
- const content = `${existing}${separator}
300
- # Claude Code shell completions
301
- ${shell.completionLine}
302
- `;
303
- await writeFile(shell.rcFile, content, { encoding: "utf-8" });
304
- return `${EOL}${color("success", theme)(`Installed ${shell.name} shell completions`)}${EOL}${source_default.dim(`Added to ${formatPathLink(shell.rcFile)}`)}${EOL}${source_default.dim(`Run: source ${shell.rcFile}`)}${EOL}`;
305
- } catch (error) {
306
- logError(error);
307
- return `${EOL}${color("warning", theme)(`Could not install ${shell.name} shell completions`)}${EOL}${source_default.dim(`Add this to ${formatPathLink(shell.rcFile)}:`)}${EOL}${source_default.dim(shell.completionLine)}${EOL}`;
308
- }
309
- }
310
- var EOL = `
311
- `;
312
- var init_completionCache = __esm(() => {
313
- init_source();
314
- init_src();
315
- init_src();
316
- init_debug();
317
- init_errors();
318
- init_execFileNoThrow();
319
- init_log();
320
- });
321
-
322
- // src/commands/terminalSetup/terminalSetup.tsx
323
- import { randomBytes } from "crypto";
324
- import { copyFile, mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
325
- import { homedir as homedir3, platform } from "os";
326
- import { dirname as dirname2, join as join4 } from "path";
327
- import { pathToFileURL as pathToFileURL2 } from "url";
328
- function isVSCodeRemoteSSH() {
329
- const askpassMain = process.env.VSCODE_GIT_ASKPASS_MAIN ?? "";
330
- const path = process.env.PATH ?? "";
331
- return askpassMain.includes(".vscode-server") || askpassMain.includes(".cursor-server") || askpassMain.includes(".windsurf-server") || path.includes(".vscode-server") || path.includes(".cursor-server") || path.includes(".windsurf-server");
332
- }
333
- function getNativeCSIuTerminalDisplayName() {
334
- if (!env.terminal || !(env.terminal in NATIVE_CSIU_TERMINALS)) {
335
- return null;
336
- }
337
- return NATIVE_CSIU_TERMINALS[env.terminal] ?? null;
338
- }
339
- function formatPathLink2(filePath) {
340
- if (!supportsHyperlinks()) {
341
- return filePath;
342
- }
343
- const fileUrl = pathToFileURL2(filePath).href;
344
- return `\x1B]8;;${fileUrl}\x07${filePath}\x1B]8;;\x07`;
345
- }
346
- function shouldOfferTerminalSetup() {
347
- return platform() === "darwin" && env.terminal === "Apple_Terminal" || env.terminal === "vscode" || env.terminal === "cursor" || env.terminal === "windsurf" || env.terminal === "alacritty" || env.terminal === "zed";
348
- }
349
- async function setupTerminal(theme) {
350
- let result = "";
351
- switch (env.terminal) {
352
- case "Apple_Terminal":
353
- result = await enableOptionAsMetaForTerminal(theme);
354
- break;
355
- case "vscode":
356
- result = await installBindingsForVSCodeTerminal("VSCode", theme);
357
- break;
358
- case "cursor":
359
- result = await installBindingsForVSCodeTerminal("Cursor", theme);
360
- break;
361
- case "windsurf":
362
- result = await installBindingsForVSCodeTerminal("Windsurf", theme);
363
- break;
364
- case "alacritty":
365
- result = await installBindingsForAlacritty(theme);
366
- break;
367
- case "zed":
368
- result = await installBindingsForZed(theme);
369
- break;
370
- case null:
371
- break;
372
- }
373
- saveGlobalConfig((current) => {
374
- if (["vscode", "cursor", "windsurf", "alacritty", "zed"].includes(env.terminal ?? "")) {
375
- if (current.shiftEnterKeyBindingInstalled === true)
376
- return current;
377
- return { ...current, shiftEnterKeyBindingInstalled: true };
378
- } else if (env.terminal === "Apple_Terminal") {
379
- if (current.optionAsMetaKeyInstalled === true)
380
- return current;
381
- return { ...current, optionAsMetaKeyInstalled: true };
382
- }
383
- return current;
384
- });
385
- maybeMarkProjectOnboardingComplete();
386
- if (process.env.USER_TYPE === "ant") {
387
- result += await setupShellCompletion(theme);
388
- }
389
- return result;
390
- }
391
- function isShiftEnterKeyBindingInstalled() {
392
- return getGlobalConfig().shiftEnterKeyBindingInstalled === true;
393
- }
394
- function hasUsedBackslashReturn() {
395
- return getGlobalConfig().hasUsedBackslashReturn === true;
396
- }
397
- function markBackslashReturnUsed() {
398
- const config = getGlobalConfig();
399
- if (!config.hasUsedBackslashReturn) {
400
- saveGlobalConfig((current) => ({
401
- ...current,
402
- hasUsedBackslashReturn: true
403
- }));
404
- }
405
- }
406
- async function call(onDone, context, _args) {
407
- if (env.terminal && env.terminal in NATIVE_CSIU_TERMINALS) {
408
- const message = `Shift+Enter is natively supported in ${NATIVE_CSIU_TERMINALS[env.terminal]}.
409
-
410
- No configuration needed. Just use Shift+Enter to add newlines.`;
411
- onDone(message);
412
- return null;
413
- }
414
- if (!shouldOfferTerminalSetup()) {
415
- const terminalName = env.terminal || "your current terminal";
416
- const currentPlatform = getPlatform();
417
- let platformTerminals = "";
418
- if (currentPlatform === "macos") {
419
- platformTerminals = ` \u2022 macOS: Apple Terminal
420
- `;
421
- } else if (currentPlatform === "windows") {
422
- platformTerminals = ` \u2022 Windows: Windows Terminal
423
- `;
424
- }
425
- const message = `Terminal setup cannot be run from ${terminalName}.
426
-
427
- This command configures a convenient Shift+Enter shortcut for multi-line prompts.
428
- ${source_default.dim("Note: You can already use backslash (\\\\) + return to add newlines.")}
429
-
430
- To set up the shortcut (optional):
431
- 1. Exit tmux/screen temporarily
432
- 2. Run /terminal-setup directly in one of these terminals:
433
- ${platformTerminals} \u2022 IDE: VSCode, Cursor, Windsurf, Zed
434
- \u2022 Other: Alacritty
435
- 3. Return to tmux/screen - settings will persist
436
-
437
- ${source_default.dim("Note: iTerm2, WezTerm, Ghostty, Kitty, and Warp support Shift+Enter natively.")}`;
438
- onDone(message);
439
- return null;
440
- }
441
- const result = await setupTerminal(context.options.theme);
442
- onDone(result);
443
- return null;
444
- }
445
- async function installBindingsForVSCodeTerminal(editor = "VSCode", theme) {
446
- if (isVSCodeRemoteSSH()) {
447
- return `${color("warning", theme)(`Cannot install keybindings from a remote ${editor} session.`)}${EOL2}${EOL2}${editor} keybindings must be installed on your local machine, not the remote server.${EOL2}${EOL2}To install the Shift+Enter keybinding:${EOL2}1. Open ${editor} on your local machine (not connected to remote)${EOL2}2. Open the Command Palette (Cmd/Ctrl+Shift+P) \u2192 "Preferences: Open Keyboard Shortcuts (JSON)"${EOL2}3. Add this keybinding (the file must be a JSON array):${EOL2}${EOL2}${source_default.dim(`[
448
- {
449
- "key": "shift+enter",
450
- "command": "workbench.action.terminal.sendSequence",
451
- "args": { "text": "\\u001b\\r" },
452
- "when": "terminalFocus"
453
- }
454
- ]`)}${EOL2}`;
455
- }
456
- const editorDir = editor === "VSCode" ? "Code" : editor;
457
- const userDirPath = join4(homedir3(), platform() === "win32" ? join4("AppData", "Roaming", editorDir, "User") : platform() === "darwin" ? join4("Library", "Application Support", editorDir, "User") : join4(".config", editorDir, "User"));
458
- const keybindingsPath = join4(userDirPath, "keybindings.json");
459
- try {
460
- await mkdir2(userDirPath, { recursive: true });
461
- let content = "[]";
462
- let keybindings = [];
463
- let fileExists = false;
464
- try {
465
- content = await readFile2(keybindingsPath, { encoding: "utf-8" });
466
- fileExists = true;
467
- keybindings = safeParseJSONC(content) ?? [];
468
- } catch (e) {
469
- if (!isFsInaccessible(e))
470
- throw e;
471
- }
472
- if (fileExists) {
473
- const randomSha = randomBytes(4).toString("hex");
474
- const backupPath = `${keybindingsPath}.${randomSha}.bak`;
475
- try {
476
- await copyFile(keybindingsPath, backupPath);
477
- } catch {
478
- return `${color("warning", theme)(`Error backing up existing ${editor} terminal keybindings. Bailing out.`)}${EOL2}${source_default.dim(`See ${formatPathLink2(keybindingsPath)}`)}${EOL2}${source_default.dim(`Backup path: ${formatPathLink2(backupPath)}`)}${EOL2}`;
479
- }
480
- }
481
- const existingBinding = keybindings.find((binding) => binding.key === "shift+enter" && binding.command === "workbench.action.terminal.sendSequence" && binding.when === "terminalFocus");
482
- if (existingBinding) {
483
- return `${color("warning", theme)(`Found existing ${editor} terminal Shift+Enter key binding. Remove it to continue.`)}${EOL2}${source_default.dim(`See ${formatPathLink2(keybindingsPath)}`)}${EOL2}`;
484
- }
485
- const newKeybinding = {
486
- key: "shift+enter",
487
- command: "workbench.action.terminal.sendSequence",
488
- args: { text: "\x1B\r" },
489
- when: "terminalFocus"
490
- };
491
- const updatedContent = addItemToJSONCArray(content, newKeybinding);
492
- await writeFile2(keybindingsPath, updatedContent, { encoding: "utf-8" });
493
- return `${color("success", theme)(`Installed ${editor} terminal Shift+Enter key binding`)}${EOL2}${source_default.dim(`See ${formatPathLink2(keybindingsPath)}`)}${EOL2}`;
494
- } catch (error) {
495
- logError(error);
496
- throw new Error(`Failed to install ${editor} terminal Shift+Enter key binding`);
497
- }
498
- }
499
- async function enableOptionAsMetaForProfile(profileName) {
500
- const { code: addCode } = await execFileNoThrow("/usr/libexec/PlistBuddy", [
501
- "-c",
502
- `Add :'Window Settings':'${profileName}':useOptionAsMetaKey bool true`,
503
- getTerminalPlistPath()
504
- ]);
505
- if (addCode !== 0) {
506
- const { code: setCode } = await execFileNoThrow("/usr/libexec/PlistBuddy", [
507
- "-c",
508
- `Set :'Window Settings':'${profileName}':useOptionAsMetaKey true`,
509
- getTerminalPlistPath()
510
- ]);
511
- if (setCode !== 0) {
512
- logError(new Error(`Failed to enable Option as Meta key for Terminal.app profile: ${profileName}`));
513
- return false;
514
- }
515
- }
516
- return true;
517
- }
518
- async function disableAudioBellForProfile(profileName) {
519
- const { code: addCode } = await execFileNoThrow("/usr/libexec/PlistBuddy", [
520
- "-c",
521
- `Add :'Window Settings':'${profileName}':Bell bool false`,
522
- getTerminalPlistPath()
523
- ]);
524
- if (addCode !== 0) {
525
- const { code: setCode } = await execFileNoThrow("/usr/libexec/PlistBuddy", [
526
- "-c",
527
- `Set :'Window Settings':'${profileName}':Bell false`,
528
- getTerminalPlistPath()
529
- ]);
530
- if (setCode !== 0) {
531
- logError(new Error(`Failed to disable audio bell for Terminal.app profile: ${profileName}`));
532
- return false;
533
- }
534
- }
535
- return true;
536
- }
537
- async function enableOptionAsMetaForTerminal(theme) {
538
- try {
539
- const backupPath = await backupTerminalPreferences();
540
- if (!backupPath) {
541
- throw new Error("Failed to create backup of Terminal.app preferences, bailing out");
542
- }
543
- const { stdout: defaultProfile, code: readCode } = await execFileNoThrow("defaults", ["read", "com.apple.Terminal", "Default Window Settings"]);
544
- if (readCode !== 0 || !defaultProfile.trim()) {
545
- throw new Error("Failed to read default Terminal.app profile");
546
- }
547
- const { stdout: startupProfile, code: startupCode } = await execFileNoThrow("defaults", ["read", "com.apple.Terminal", "Startup Window Settings"]);
548
- if (startupCode !== 0 || !startupProfile.trim()) {
549
- throw new Error("Failed to read startup Terminal.app profile");
550
- }
551
- let wasAnyProfileUpdated = false;
552
- const defaultProfileName = defaultProfile.trim();
553
- const optionAsMetaEnabled = await enableOptionAsMetaForProfile(defaultProfileName);
554
- const audioBellDisabled = await disableAudioBellForProfile(defaultProfileName);
555
- if (optionAsMetaEnabled || audioBellDisabled) {
556
- wasAnyProfileUpdated = true;
557
- }
558
- const startupProfileName = startupProfile.trim();
559
- if (startupProfileName !== defaultProfileName) {
560
- const startupOptionAsMetaEnabled = await enableOptionAsMetaForProfile(startupProfileName);
561
- const startupAudioBellDisabled = await disableAudioBellForProfile(startupProfileName);
562
- if (startupOptionAsMetaEnabled || startupAudioBellDisabled) {
563
- wasAnyProfileUpdated = true;
564
- }
565
- }
566
- if (!wasAnyProfileUpdated) {
567
- throw new Error("Failed to enable Option as Meta key or disable audio bell for any Terminal.app profile");
568
- }
569
- await execFileNoThrow("killall", ["cfprefsd"]);
570
- markTerminalSetupComplete();
571
- return `${color("success", theme)(`Configured Terminal.app settings:`)}${EOL2}${color("success", theme)('- Enabled "Use Option as Meta key"')}${EOL2}${color("success", theme)("- Switched to visual bell")}${EOL2}${source_default.dim("Option+Enter will now enter a newline.")}${EOL2}${source_default.dim("You must restart Terminal.app for changes to take effect.", theme)}${EOL2}`;
572
- } catch (error) {
573
- logError(error);
574
- const restoreResult = await checkAndRestoreTerminalBackup();
575
- const errorMessage = "Failed to enable Option as Meta key for Terminal.app.";
576
- if (restoreResult.status === "restored") {
577
- throw new Error(`${errorMessage} Your settings have been restored from backup.`);
578
- } else if (restoreResult.status === "failed") {
579
- throw new Error(`${errorMessage} Restoring from backup failed, try manually with: defaults import com.apple.Terminal ${restoreResult.backupPath}`);
580
- } else {
581
- throw new Error(`${errorMessage} No backup was available to restore from.`);
582
- }
583
- }
584
- }
585
- async function installBindingsForAlacritty(theme) {
586
- const ALACRITTY_KEYBINDING = `[[keyboard.bindings]]
587
- key = "Return"
588
- mods = "Shift"
589
- chars = "\\u001B\\r"`;
590
- const configPaths = [];
591
- const xdgConfigHome = process.env.XDG_CONFIG_HOME;
592
- if (xdgConfigHome) {
593
- configPaths.push(join4(xdgConfigHome, "alacritty", "alacritty.toml"));
594
- } else {
595
- configPaths.push(join4(homedir3(), ".config", "alacritty", "alacritty.toml"));
596
- }
597
- if (platform() === "win32") {
598
- const appData = process.env.APPDATA;
599
- if (appData) {
600
- configPaths.push(join4(appData, "alacritty", "alacritty.toml"));
601
- }
602
- }
603
- let configPath = null;
604
- let configContent = "";
605
- let configExists = false;
606
- for (const path of configPaths) {
607
- try {
608
- configContent = await readFile2(path, { encoding: "utf-8" });
609
- configPath = path;
610
- configExists = true;
611
- break;
612
- } catch (e) {
613
- if (!isFsInaccessible(e))
614
- throw e;
615
- }
616
- }
617
- if (!configPath) {
618
- configPath = configPaths[0] ?? null;
619
- }
620
- if (!configPath) {
621
- throw new Error("No valid config path found for Alacritty");
622
- }
623
- try {
624
- if (configExists) {
625
- if (configContent.includes('mods = "Shift"') && configContent.includes('key = "Return"')) {
626
- return `${color("warning", theme)("Found existing Alacritty Shift+Enter key binding. Remove it to continue.")}${EOL2}${source_default.dim(`See ${formatPathLink2(configPath)}`)}${EOL2}`;
627
- }
628
- const randomSha = randomBytes(4).toString("hex");
629
- const backupPath = `${configPath}.${randomSha}.bak`;
630
- try {
631
- await copyFile(configPath, backupPath);
632
- } catch {
633
- return `${color("warning", theme)("Error backing up existing Alacritty config. Bailing out.")}${EOL2}${source_default.dim(`See ${formatPathLink2(configPath)}`)}${EOL2}${source_default.dim(`Backup path: ${formatPathLink2(backupPath)}`)}${EOL2}`;
634
- }
635
- } else {
636
- await mkdir2(dirname2(configPath), { recursive: true });
637
- }
638
- let updatedContent = configContent;
639
- if (configContent && !configContent.endsWith(`
640
- `)) {
641
- updatedContent += `
642
- `;
643
- }
644
- updatedContent += `
645
- ` + ALACRITTY_KEYBINDING + `
646
- `;
647
- await writeFile2(configPath, updatedContent, { encoding: "utf-8" });
648
- return `${color("success", theme)("Installed Alacritty Shift+Enter key binding")}${EOL2}${color("success", theme)("You may need to restart Alacritty for changes to take effect")}${EOL2}${source_default.dim(`See ${formatPathLink2(configPath)}`)}${EOL2}`;
649
- } catch (error) {
650
- logError(error);
651
- throw new Error("Failed to install Alacritty Shift+Enter key binding");
652
- }
653
- }
654
- async function installBindingsForZed(theme) {
655
- const zedDir = join4(homedir3(), ".config", "zed");
656
- const keymapPath = join4(zedDir, "keymap.json");
657
- try {
658
- await mkdir2(zedDir, { recursive: true });
659
- let keymapContent = "[]";
660
- let fileExists = false;
661
- try {
662
- keymapContent = await readFile2(keymapPath, { encoding: "utf-8" });
663
- fileExists = true;
664
- } catch (e) {
665
- if (!isFsInaccessible(e))
666
- throw e;
667
- }
668
- if (fileExists) {
669
- if (keymapContent.includes("shift-enter")) {
670
- return `${color("warning", theme)("Found existing Zed Shift+Enter key binding. Remove it to continue.")}${EOL2}${source_default.dim(`See ${formatPathLink2(keymapPath)}`)}${EOL2}`;
671
- }
672
- const randomSha = randomBytes(4).toString("hex");
673
- const backupPath = `${keymapPath}.${randomSha}.bak`;
674
- try {
675
- await copyFile(keymapPath, backupPath);
676
- } catch {
677
- return `${color("warning", theme)("Error backing up existing Zed keymap. Bailing out.")}${EOL2}${source_default.dim(`See ${formatPathLink2(keymapPath)}`)}${EOL2}${source_default.dim(`Backup path: ${formatPathLink2(backupPath)}`)}${EOL2}`;
678
- }
679
- }
680
- let keymap;
681
- try {
682
- keymap = jsonParse(keymapContent);
683
- if (!Array.isArray(keymap)) {
684
- keymap = [];
685
- }
686
- } catch {
687
- keymap = [];
688
- }
689
- keymap.push({
690
- context: "Terminal",
691
- bindings: {
692
- "shift-enter": ["terminal::SendText", "\x1B\r"]
693
- }
694
- });
695
- await writeFile2(keymapPath, jsonStringify(keymap, null, 2) + `
696
- `, {
697
- encoding: "utf-8"
698
- });
699
- return `${color("success", theme)("Installed Zed Shift+Enter key binding")}${EOL2}${source_default.dim(`See ${formatPathLink2(keymapPath)}`)}${EOL2}`;
700
- } catch (error) {
701
- logError(error);
702
- throw new Error("Failed to install Zed Shift+Enter key binding");
703
- }
704
- }
705
- var EOL2 = `
706
- `, NATIVE_CSIU_TERMINALS;
707
- var init_terminalSetup = __esm(() => {
708
- init_source();
709
- init_src();
710
- init_src();
711
- init_projectOnboardingState();
712
- init_appleTerminalBackup();
713
- init_completionCache();
714
- init_config();
715
- init_env();
716
- init_errors();
717
- init_execFileNoThrow();
718
- init_json();
719
- init_log();
720
- init_platform();
721
- init_slowOperations();
722
- NATIVE_CSIU_TERMINALS = {
723
- ghostty: "Ghostty",
724
- kitty: "Kitty",
725
- "iTerm.app": "iTerm2",
726
- WezTerm: "WezTerm",
727
- WarpTerminal: "Warp"
728
- };
729
- });
730
-
731
- export { getSteps, maybeMarkProjectOnboardingComplete, shouldShowProjectOnboarding, incrementProjectOnboardingSeenCount, init_projectOnboardingState, checkAndRestoreTerminalBackup, init_appleTerminalBackup, getNativeCSIuTerminalDisplayName, shouldOfferTerminalSetup, setupTerminal, isShiftEnterKeyBindingInstalled, hasUsedBackslashReturn, markBackslashReturnUsed, call, init_terminalSetup };