Skip to content

feat(twitter): add tweets command for fetching user's recent posts#1098

Merged
jackwener merged 2 commits intomainfrom
feat/twitter-tweets
Apr 20, 2026
Merged

feat(twitter): add tweets command for fetching user's recent posts#1098
jackwener merged 2 commits intomainfrom
feat/twitter-tweets

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

Adds opencli twitter tweets <username> [--limit N] — pulls a user's most recent chronological tweets via Twitter's UserTweets GraphQL endpoint.

  • Resolves screen name → userId via UserByScreenName
  • Paginates up to 5 pages to hit the requested limit (max 200)
  • Long posts resolve via note_tweet.note_tweet_results.result.text; falls back to legacy.full_text
  • Skips TimelinePinEntry so output is strictly chronological
  • Flags retweets via legacy.retweeted_status_result or RT @ prefix
  • views.count is stringly-typed in the payload — coerced to Number
  • QueryIds resolve dynamically through resolveTwitterQueryId (shared with likes.js), with hardcoded fallbacks if discovery fails

Verified live against @jakevin7 pulling both 10 and 20 tweets.

Test plan

  • npm run build — manifest regenerates with the new entry
  • npm test — full suite passes (1615 passed, 2 skipped)
  • npx vitest run clis/twitter/tweets.test.js — 6 new tests green
  • Live run: opencli twitter tweets jakevin7 --limit 20 -f json returns 20 tweets with populated fields

Adds `opencli twitter tweets <username> [--limit N]` to pull a user's
most recent chronological tweets via the UserTweets GraphQL endpoint.
Long posts resolve via note_tweet, pinned entries are skipped, and
retweets are flagged. QueryIds resolve dynamically through
`resolveTwitterQueryId` with hardcoded fallbacks.
@jackwener jackwener merged commit 9339565 into main Apr 20, 2026
11 checks passed
luxiaolei pushed a commit to luxiaolei/OpenCLI that referenced this pull request Apr 21, 2026
…ackwener#1098)

* feat(twitter): add tweets command for fetching a user's recent posts

Adds `opencli twitter tweets <username> [--limit N]` to pull a user's
most recent chronological tweets via the UserTweets GraphQL endpoint.
Long posts resolve via note_tweet, pinned entries are skipped, and
retweets are flagged. QueryIds resolve dynamically through
`resolveTwitterQueryId` with hardcoded fallbacks.

* fix(twitter): expose retweet flag in tweets output

(cherry picked from commit 9339565)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant