2.3 KiB
2.3 KiB
bird 🐦
bird is a focused command-line tool for posting tweets, replying, and reading tweet details using Twitter/X's GraphQL API. It keeps setup minimal while supporting common workflows for automation or scripting.
Installation
cd ~/Projects/bird
pnpm install
pnpm run binary # Creates the 'bird' executable
Usage
Commands at a glance
bird tweet "<text>"— post a new tweet.bird reply <tweet-id-or-url> "<text>"— reply to a tweet using its ID or URL.bird read <tweet-id-or-url> [--json]— fetch tweet content as text or JSON.bird check— show which credentials are available and where they were sourced from.
Post a tweet
bird tweet "Hello from bird!"
Reply to a tweet
# Using tweet URL
bird reply "https://x.com/user/status/1234567890" "This is my reply"
# Using tweet ID directly
bird reply 1234567890 "This is my reply"
Read a tweet
# Get tweet content by URL or ID
bird read "https://x.com/user/status/1234567890"
bird read 1234567890 --json
Check credentials
bird check
Authentication
bird resolves credentials in the following order of priority:
-
CLI arguments (highest priority)
bird --auth-token "xxx" --ct0 "yyy" tweet "Hello" -
Environment variables
export AUTH_TOKEN="xxx" export CT0="yyy" bird tweet "Hello"Alternative env var names:
TWITTER_AUTH_TOKEN,TWITTER_CT0 -
Chrome cookies (fallback - macOS only)
- Automatically extracts from Chrome's cookie database
- Requires Chrome to be logged into x.com
- May prompt for keychain access on first run
Getting Your Cookies
- Open Chrome and log into x.com
- Open DevTools (Cmd+Option+I)
- Go to Application > Cookies > x.com
- Copy the values for
auth_tokenandct0
Development
# Run in development mode
pnpm run dev tweet "Test"
# Run tests
pnpm test
# Run linter
pnpm run lint
# Fix lint issues
pnpm run lint:fix
Notes
- Chrome cookie extraction requires macOS (uses
sqlite3andsecurityCLI tools). - The keychain access may block when running over SSH; use environment variables instead.
- Twitter/X may rotate GraphQL query IDs; update
src/lib/twitter-client.tsif requests start failing.