xeet
v0.1.0
Published
X Platform CLI for AI Agents
Downloads
10
Readme
xeet — X (Twitter) in your terminal.
Fast, agent-friendly CLI for the X platform. JSON-first output, OAuth 2.0 PKCE auth, and zero runtime dependencies beyond Node.js.
Features
- Post — create, reply, quote, thread, delete
- Read — get any post by ID with full metadata
- Timeline — home feed or any user's posts
- Search — recent posts with sort control
- Interact — like, repost, bookmark (OAuth 2.0 exclusive)
- Users — profile lookup, followers, following
- Mentions — posts mentioning the authenticated user
- Dual auth — OAuth 2.0 PKCE (recommended) with OAuth 1.0a fallback
- Auto token refresh — authenticate once, use indefinitely
- Agent-first — structured JSON on stdout, errors on stderr, meaningful exit codes
Installation
From source
git clone https://github.com/wangwalk/xeet.git
cd xeet
npm install
npm run buildRun:
node bin/xeet.js --helpOr link globally:
npm link
xeet --helpQuick Start
1. Get OAuth 2.0 Credentials
- Go to X Developer Portal
- Create or open your App
- In User authentication settings, enable OAuth 2.0
- Type: Native App (public client, no secret needed)
- Callback URL:
http://127.0.0.1:8477/callback - Copy your Client ID
2. Authenticate
xeet auth login --client-id <your-client-id>This opens a browser for authorization. After approving, tokens are saved to ~/.config/xeet/credentials.json.
3. Verify
xeet auth status4. Use
xeet post "Hello from xeet"
xeet user @XDevelopers
xeet bookmark <tweet-id>Authentication
OAuth 2.0 PKCE (recommended)
xeet auth login --client-id <id> [--client-secret <secret>] [--port 8477]Tokens auto-refresh via offline.access scope. Supports all endpoints including OAuth 2.0 exclusive features like Bookmarks.
OAuth 1.0a (legacy)
xeet auth setupInteractive prompt for API Key, API Secret, Access Token, and Access Token Secret.
Environment Variables
For CI/agent environments, set credentials via env vars:
# OAuth 2.0
export XEET_ACCESS_TOKEN=<token>
export XEET_REFRESH_TOKEN=<refresh-token> # optional
export XEET_CLIENT_ID=<client-id> # optional
# OAuth 1.0a (all four required)
export XEET_API_KEY=<key>
export XEET_API_SECRET=<secret>
export XEET_ACCESS_TOKEN=<token>
export XEET_ACCESS_TOKEN_SECRET=<token-secret>Detection priority: OAuth 1.0a (all four keys present) > OAuth 2.0 (access token only) > config file.
Auth Status
xeet auth statusShows auth type, credential source, user info, and for OAuth 2.0: token expiry and granted scopes.
Commands
Posts
xeet post "Hello world" # Create a post
xeet reply <id> "Nice post!" # Reply to a post
xeet quote <id> "Check this out" # Quote a post
xeet thread "First" "Second" "Third" # Post a thread
xeet delete <id> # Delete a post
xeet read <id> # Get a post by IDTimeline
xeet timeline # Home timeline
xeet timeline @username # User's posts
xeet timeline --limit 50 # Control result count
xeet timeline --since 2h # Filter by time (2h, 30m, 1d, ISO date)Search
xeet search "query" # Search recent posts
xeet search "from:user" --limit 10 # With limit
xeet search "query" --sort relevancy # Sort by relevancy (default: recency)Interactions
xeet like <id> # Like a post
xeet repost <id> # Repost (retweet)
xeet bookmark <id> # Bookmark (OAuth 2.0 only)Users
xeet user @username # Get user profile
xeet followers @username --limit 50 # Get followers
xeet following @username --limit 50 # Get followingMentions
xeet mentions # Recent mentions
xeet mentions --limit 10 --since 1d # With filtersOutput Format
All output is structured JSON on stdout. Errors go to stderr.
Success
{
"ok": true,
"data": {
"id": "123456",
"text": "Hello world"
}
}Error
{
"ok": false,
"error": {
"code": "AUTH_MISSING",
"message": "No credentials found."
}
}Exit Codes
| Code | Meaning | |------|---------| | 0 | Success | | 1 | General error | | 2 | Auth error | | 3 | Rate limited | | 4 | Invalid arguments |
Pretty Print
xeet --pretty user @XDevelopers # Human-friendly indented JSONPiping
xeet timeline @user --limit 10 | jq '.data.posts[].text'Development
git clone https://github.com/wangwalk/xeet.git
cd xeet
npm install
npm run build # Build with tsup
npm run typecheck # Type check without emitting
npm run dev # Watch modeStack
- TypeScript + tsup (ESM, Node 18+)
- Commander.js for CLI parsing
- @xdevplatform/xdk for X API client
- Zero runtime dependencies beyond the above
License
MIT
