The CLI (x.ts) currently supports a single command:
x post "text"— posts a basic tweet
The postTweet() function sends a simple { text } body to the Twitter v2 API (/2/tweets).
Add support for:
- Quote tweets — retweet with your own commentary
- Replies — respond to an existing tweet
The /2/tweets endpoint accepts these additional fields:
{
"text": "Your tweet text",
"quote_tweet_id": "1234567890", // for quote tweets
"reply": { // for replies
"in_reply_to_tweet_id": "1234567890"
}
}Add optional parameters for quote and reply:
interface TweetOptions {
text: string;
quoteTweetId?: string; // for quote tweets
replyToId?: string; // for replies
}
async function postTweet(options: TweetOptions, config: XConfig) {
// Build request body dynamically
const body: Record<string, any> = { text: options.text };
if (options.quoteTweetId) {
body.quote_tweet_id = options.quoteTweetId;
}
if (options.replyToId) {
body.reply = { in_reply_to_tweet_id: options.replyToId };
}
// ... rest of OAuth + fetch logic
}New command structure:
x post "text" # basic tweet
x quote <tweet_id> "text" # quote tweet
x reply <tweet_id> "text" # reply to tweet
Users will often paste full URLs like:
https://x.com/user/status/1234567890https://twitter.com/user/status/1234567890
Add a helper to extract the ID:
function extractTweetId(input: string): string {
// If it's a URL, extract the ID from /status/ID
const match = input.match(/\/status\/(\d+)/);
return match ? match[1] : input;
}x-cli - Simple X (Twitter) posting CLI
Usage:
x post <text> Post a tweet
x quote <tweet_id|url> <text> Quote tweet with commentary
x reply <tweet_id|url> <text> Reply to a tweet
x help Show this help
Examples:
x post "Hello from the CLI!"
x quote 1234567890 "This is so true!"
x quote https://x.com/user/status/1234567890 "Great thread"
x reply 1234567890 "Thanks for sharing!"
Update x.prompt.md to document the new commands for Zo.
- Add
TweetOptionsinterface - Refactor
postTweet()to accept options object - Add
extractTweetId()helper function - Add
quotecommand to CLI - Add
replycommand to CLI - Update help text
- Update
x.prompt.mdwith new commands - Test all three commands
- Tweet ID is always numeric and typically 19 digits
- Quote tweets show the original tweet embedded below your text
- Replies appear in the thread under the original tweet
- Both require the original tweet to be public (or from an account you follow)