A simple tool which lets you scrape twitter accounts and crosspost them to bluesky accounts! Comes with a CLI and a webapp for managing profiles! Works with images/videos/link embeds/threads.
1#!/usr/bin/env bash
2
3set -euo pipefail
4
5resolve_bun_bin() {
6 if command -v bun >/dev/null 2>&1; then
7 command -v bun
8 return 0
9 fi
10
11 if [[ -x "${HOME}/.bun/bin/bun" ]]; then
12 printf '%s\n' "${HOME}/.bun/bin/bun"
13 return 0
14 fi
15
16 return 1
17}
18
19install_latest_bun() {
20 if command -v curl >/dev/null 2>&1; then
21 curl -fsSL https://bun.sh/install | bash >/dev/null
22 return 0
23 fi
24
25 if command -v wget >/dev/null 2>&1; then
26 wget -qO- https://bun.sh/install | bash >/dev/null
27 return 0
28 fi
29
30 return 1
31}
32
33declare -a BUN_RUNNER=()
34
35resolve_bun_runner() {
36 local bun_bin
37 bun_bin="$(resolve_bun_bin || true)"
38
39 if [[ -z "$bun_bin" || ! -x "$bun_bin" ]]; then
40 echo "📦 Bun not found. Installing latest Bun..."
41 if install_latest_bun; then
42 bun_bin="$(resolve_bun_bin || true)"
43 fi
44 fi
45
46 if [[ -n "$bun_bin" && -x "$bun_bin" ]]; then
47 if ! "$bun_bin" upgrade >/dev/null 2>&1; then
48 echo "⚠️ Bun auto-upgrade failed. Reinstalling latest Bun..."
49 if install_latest_bun; then
50 bun_bin="$(resolve_bun_bin || true)"
51 fi
52 fi
53 fi
54
55 if [[ -n "$bun_bin" && -x "$bun_bin" ]]; then
56 BUN_RUNNER=("$bun_bin")
57 return 0
58 fi
59
60 if command -v npx >/dev/null 2>&1; then
61 echo "⚠️ Could not install global Bun automatically. Falling back to npx bun."
62 BUN_RUNNER=("npx" "bun")
63 return 0
64 fi
65
66 echo "❌ Bun is required to rebuild native modules."
67 echo " Install Bun: https://bun.com/docs/installation"
68 exit 1
69}
70
71resolve_bun_runner
72
73echo "🔧 Rebuilding native modules for Bun..."
74echo " Runner: ${BUN_RUNNER[*]}"
75
76if "${BUN_RUNNER[@]}" install --force; then
77 echo "✅ Native modules rebuilt via fresh Bun install."
78 exit 0
79fi
80
81echo "❌ Failed to rebuild native modules with Bun."
82echo " macOS: run 'xcode-select --install'"
83echo " Debian/Ubuntu: sudo apt-get install -y build-essential python3 make g++"
84echo " Then run: bun run rebuild:native"
85exit 1