Commit Graph
275 Commits
Author SHA1 Message Date
Peter Steinberger c96ce5238f fix: tighten news output and parsing (#39) (thanks @aavetis) 2026-01-12 05:37:44 +00:00
aavetisandClaude Sonnet 4.5 fb092f5cec feat: add multi-tab fetching to news command for 5x more headlines
Completely rewrites the news command to fetch from multiple Explore tabs
(For You, News, Sports, Entertainment) using GenericTimelineById GraphQL
API instead of just the ExplorePage initialTimeline. This delivers 15+
AI-curated headlines instead of 3, a 5x improvement in content discovery.

Key Changes:
- Add GenericTimelineById query ID support with auto-refresh capability
- Implement multi-tab fetching with cross-tab headline deduplication
- Add CLI flags for granular tab filtering (--for-you, --news-only,
  --sports, --entertainment, --trending-only)
- Fetch from 4 tabs by default (excludes trending to reduce noise)
- Add early stopping optimization when count is reached
- Handle tab-level errors gracefully without failing entire request

Implementation:
- Added TIMELINE_IDS constant with base64 timeline identifiers
- Created fetchTimelineTab() method for GenericTimelineById requests
- Created parseTimelineTabItems() for new response structure
- Removed old parseNewsItems() and extractNewsItemsFromInstructions()
- Updated all 7 tests to mock GenericTimelineById responses

API Changes:
- NewsFetchOptions: Added `tabs?: ExploreTab[]` option
- ExploreTab type exported for library consumers
- Backward compatible - existing code continues to work

Documentation:
- Added comprehensive "News & Trending" section with examples
- Updated command reference with all new flags
- Added library usage examples with tab filtering
- Updated JSON schema documentation

Testing:
- All 268 tests passing
- Real-world verified: fetches 15+ AI headlines across tabs
- Tab filtering verified: --sports, --entertainment, etc all work

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
2026-01-12 05:33:19 +00:00
aavetisandClaude Sonnet 4.5 57d1498f1d feat: add news command to fetch AI-curated headlines
Add comprehensive news/trending feature that fetches AI-generated news
headlines from Twitter's "For You" page. This feature specifically
targets the AI-curated news items that Twitter displays under "Today's
News" section, not generic trending hashtags.

- Uses Twitter's ExplorePage GraphQL API endpoint to access the Explore
  page timeline data where AI headlines are located
- AI headlines are identified by the explicit `is_ai_trend: true` flag
  in the API response
- Fallback heuristic detection for full-sentence headlines (5+ words)
  with "News" or time indicators in social context
- Headlines are found in "stories-*" modules within the initialTimeline
  structure under a "Today's News" header
- Follows the existing mixin pattern (withNews) for composability
- Supports both AI-only filtering and mixed trending/AI results

- `bird news` - Fetch news and trending topics (mixed results)
- `bird news --ai-only` - Fetch ONLY AI-curated headlines
- `bird news -n <count>` - Limit number of results
- `bird news --json` - Output as JSON
- `bird news --json-full` - Include raw API response
- `bird news --with-tweets` - Enrich with related tweets
- `bird trending` - Alias for news command
- AI headlines are clearly marked with "AI · " category prefix
- Automatic deduplication of duplicate headlines
- Rich formatting with category, time, post count, and URLs

- src/commands/news.ts - CLI command implementation
- src/lib/twitter-client-news.ts - Core news fetching functionality
- tests/commands.news.test.ts - Command validation tests (7 tests)
- tests/twitter-client-coverage.news.test.ts - API coverage tests (7 tests)

- README.md - Added documentation for news command
- src/cli/program.ts - Registered news command
- src/lib/index.ts - Exported news-related types
- src/lib/twitter-client.ts - Integrated withNews mixin
- src/lib/query-ids.json - Added ExplorePage query ID
- src/lib/twitter-client-constants.ts - Added ExplorePage constant
- src/lib/twitter-client-features.ts - Added buildExploreFeatures()
- scripts/update-query-ids.ts - Added ExplorePage to update script

- All 268 existing tests continue to pass
- Added 14 new tests covering command validation and API functionality
- Tested with real Twitter data confirming AI headline detection
- All TypeScript compilation and linting checks pass

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
2026-01-12 05:32:06 +00:00
Peter Steinberger abc6db411d docs: add live longform test note 2026-01-12 05:22:00 +00:00
Peter Steinberger cbf99a12ab Merge pull request #36 from crcatala/feature/longform-tweet-rich-content
feat: support rich content in long-form tweets (X Articles)
2026-01-12 05:14:53 +00:00
Peter Steinberger 28695d2ef0 fix: harden article rich content rendering (#36) (thanks @crcatala) 2026-01-12 05:14:39 +00:00
cc-vpsandChristian Catalan 316cdf77be feat: support rich content in long-form tweets (X Articles)
Add support for extracting rich content from X's long-form tweets,
including embedded code snippets, markdown blocks, quoted tweets,
and other structured content that was previously lost.

Changes:
- Add fieldToggles with withArticleRichContentState to TweetDetail API request
- Implement Draft.js content_state parser (renderContentState) that converts
  blocks and entities to readable markdown format
- Add content_state type definition to GraphqlTweetResult

Supported content:
- Block types: paragraphs, headers, ordered/unordered lists, blockquotes
- Entity types: MARKDOWN (code blocks), DIVIDER, TWEET, LINK, IMAGE

No impact on regular tweets - rich content only adds payload when present.

Includes 20 unit tests for the parser and an opt-in live smoke test.

Co-authored-by: Christian Catalan <[email protected]>
2026-01-12 05:12:33 +00:00
Peter Steinberger e0b960db1a fix: repair search and user-tweets requests 2026-01-12 05:09:28 +00:00
Peter Steinberger b51258c4e8 Merge pull request #49 from steipete/refactor/pagination-cleanup
refactor: unify pagination helpers
2026-01-12 02:59:07 +00:00
Peter Steinberger d5a527d5fb refactor: unify pagination helpers 2026-01-12 02:58:00 +00:00
Peter Steinberger e4d2773d46 Merge pull request #35 from crcatala/feat/thread-replies-pagination
feat: add pagination support for thread and replies commands
2026-01-12 02:42:17 +00:00
Peter Steinberger 16f21800b5 refactor: align replies/thread pagination (#35) (thanks @crcatala) 2026-01-12 02:41:08 +00:00
cc-vpsandChristian Catalan 90037ce880 feat: add pagination support for thread and replies commands
Add --all, --max-pages, --delay, and --cursor options to both thread
and replies commands, enabling fetching of all conversation content
with rate-limit-friendly pagination.

Changes:
- Modified fetchTweetDetail() to accept optional cursor parameter
- Added getRepliesPaged() and getThreadPaged() methods with pagination loop
- Updated CLI commands with new options (--all, --max-pages, --delay, --cursor)
- Added TweetDetailPaginationOptions interface
- JSON output includes nextCursor for scripting/resumption

Options:
- --all: Fetch all pages (no hard limit)
- --max-pages <n>: Limit number of pages when using --all
- --delay <ms>: Delay between page fetches (default: 1000ms)
- --cursor <string>: Resume from a previous cursor

Follows patterns established by bookmarks command and PR #34 (user-tweets).

Co-authored-by: Christian Catalan <[email protected]>
2026-01-12 02:35:36 +00:00
Peter Steinberger c7e2ec0495 Merge pull request #47 from steipete/chore/bump-0.7.0-unreleased
chore: start 0.7.0 (unreleased)
2026-01-12 02:20:50 +00:00
Peter Steinberger 762738484a chore: start 0.7.0 (unreleased) 2026-01-12 02:19:54 +00:00
Peter Steinberger 2d1f784415 Merge pull request #46 from steipete/fix/ci-build-dist
fix: restore build:dist and gate in CI
2026-01-12 02:17:20 +00:00
Peter Steinberger c7acdbd3fd fix: restore build:dist and gate in CI 2026-01-12 02:16:37 +00:00
Peter Steinberger da5d81d11c Merge pull request #45 from steipete/refactor/user-tweets-cleanup
refactor: user lookup + paging output cleanup
2026-01-12 02:10:53 +00:00
Peter Steinberger 9dd9efa4e3 test: split user lookup coverage 2026-01-12 02:09:52 +00:00
Peter Steinberger 436d4dfb89 refactor: centralize paged tweet printing 2026-01-12 02:09:47 +00:00
Peter Steinberger 5c0d5d1068 refactor: dedupe REST user parsing 2026-01-12 02:09:42 +00:00
Peter Steinberger 0536006012 refactor: extract user lookup mixin 2026-01-12 02:09:37 +00:00
Peter Steinberger 2f0d239b62 Merge pull request #43 from steipete/test/user-tweets-more
test: expand user-tweets coverage
2026-01-12 01:48:44 +00:00
Peter Steinberger 11cc9fbd27 test: expand user-tweets coverage 2026-01-12 01:45:41 +00:00
Peter Steinberger 64b0460c4d Merge pull request #34 from crcatala/feat/user-tweets-command
feat: add user-tweets command to fetch tweets from a user's profile
2026-01-12 01:42:24 +00:00
Peter Steinberger 21701bad5a fix: repair pnpm patchedDependencies 2026-01-12 01:41:10 +00:00
Peter Steinberger 7b5f4b3f2d docs: document user-tweets 2026-01-12 01:35:04 +00:00
Peter Steinberger 4eac0927c1 fix: paginate user-tweets by --count 2026-01-12 01:35:00 +00:00
cc-vpsandChristian Catalan df98e827f6 feat: add user-tweets command to fetch tweets from a user's profile
Adds new CLI command to fetch tweets from any user's profile timeline.

Usage:
  bird user-tweets @username [-n count] [--pages N] [--json]

Features:
- GraphQL UserByScreenName for username → userId resolution
- Cursor-based pagination with configurable delay (rate-limit safe)
- Hard cap of 10 pages to prevent abuse
- Input validation via normalizeHandle()

Includes 17 unit tests and live smoke test.

Co-authored-by: Christian Catalan <[email protected]>
2026-01-12 01:28:04 +00:00
Peter Steinberger 46255e8a38 test: add followers cursor coverage 2026-01-12 00:57:24 +00:00
Peter Steinberger c115232135 Merge pull request #33 from VACInc/feat/following-pagination
feat(following): add pagination support for following list
2026-01-12 00:47:07 +00:00
Peter Steinberger dec78547fe test: split following/likes tests (#33) (thanks @VACInc) 2026-01-12 00:46:32 +00:00
Peter Steinberger baede65f77 fix: following pagination returns cursor and errors (#33) (thanks @VACInc) 2026-01-12 00:41:34 +00:00
Peter Steinberger 138b643d8a test: add print output coverage (#32) (thanks @odysseus0) 2026-01-11 23:38:44 +00:00
Peter Steinberger 5fc6f53871 Merge pull request #32 from odysseus0/feat/text-output
feat: improve text output with article preview, quote tweets, and media
2026-01-11 23:35:48 +00:00
Peter Steinberger ba22d86f70 docs: changelog for text output (#32) (thanks @odysseus0) 2026-01-11 23:35:35 +00:00
Peter Steinberger 15aa24d2b1 fix: honor output flags in text rendering 2026-01-11 23:35:03 +00:00
George ZhangandClaude Opus 4.5 a48aa6db88 fix: remove duplicate title field in GraphqlTweetResult article type
The article type had title defined twice (at lines 83 and 135), causing
TypeScript compilation to fail with TS2300: Duplicate identifier 'title'.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
2026-01-11 23:35:03 +00:00
George ZhangandClaude Opus 4.5 d40c048333 fix: improve article detection and quote tweet display
- Use startsWith check instead of fragile length heuristic for
  detecting full article body vs preview mode
- Add media display for quote tweets (🖼️/🎬/🔄 indicators)
- Add preview_text to GraphqlTweetResult type definition to avoid
  type assertions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
2026-01-11 23:35:03 +00:00
George Zhang 0475a2e1b6 test: add tests for article metadata extraction
- extractArticleMetadata: 6 tests for title/preview extraction
- mapTweetResult: 3 tests for article field inclusion
2026-01-11 23:35:03 +00:00
George Zhang cf78fce646 feat: improve text output with article preview, quote tweets, and media
Enhance the text output format to show more useful information:

- Article tweets: Show 📰 indicator with title + preview text in feeds,
  full body when reading single tweets
- Quote tweets: Display quoted content with ┌─ QT @user formatting
- Media: Show 🖼️/🎬/🔄 indicators with URLs for photos/videos/GIFs

Also refactors single tweet read to use shared printTweets function
for consistent formatting.
2026-01-11 23:35:03 +00:00
Peter Steinberger de49a66601 docs: add home live test steps 2026-01-11 11:39:35 +00:00
Peter Steinberger b29b446d18 Merge pull request #31 from odysseus0/feat/home-timeline
feat: add home timeline command
2026-01-11 11:37:57 +00:00
Peter Steinberger 94773c66dc fix: harden home timeline pagination (#31) (thanks @odysseus0) 2026-01-11 11:36:59 +00:00
George ZhangandClaude Opus 4.5 92742cac38 refactor: rename --latest to --following for clarity
Matches Twitter's UI terminology ("For You" vs "Following" tabs),
making the flag immediately understandable to users.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
2026-01-11 11:35:57 +00:00
George ZhangandClaude Opus 4.5 5bb9e48252 refactor: move home query ID methods to mixin as private
Follow the pattern from twitter-client-timelines.ts where query ID
methods are private to the mixin that uses them, rather than protected
in the base class.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
2026-01-11 11:35:57 +00:00
George Zhang 73b8cff1b2 test: add home timeline API tests
- getHomeTimeline: success, error, API error handling
- getHomeLatestTimeline: success, error handling
- pagination: deduplication across pages

Uses realistic fixture structure based on actual API responses.
2026-01-11 11:35:57 +00:00
George Zhang ba7b00eb29 feat: add home timeline command
Add `bird home` command to fetch the authenticated user's home timeline.

- Supports "For You" feed (default) and "Following" feed (--latest)
- Uses HomeTimeline and HomeLatestTimeline GraphQL operations
- Includes count option (-n), JSON output, and pagination

Usage:
  bird home           # Get "For You" feed
  bird home --latest  # Get "Following" (chronological) feed
  bird home -n 50     # Fetch 50 tweets
2026-01-11 11:35:57 +00:00
Peter Steinberger 05e54350c7 Merge pull request #30 from zheli/feature/list-timeline-pagination
Add pagination support for list timeline
2026-01-11 11:28:01 +00:00
Peter Steinberger 6cf177f92f fix: list timeline pagination (#30) (thanks @zheli) 2026-01-11 11:27:46 +00:00