feat(twitter): add --images flag to post command#666
feat(twitter): add --images flag to post command#666artshooter wants to merge 3 commits intojackwener:mainfrom
Conversation
Support attaching up to 4 images when posting tweets via `opencli twitter post "text" --images /path/a.png,/path/b.jpg`. Uses the existing CDP DOM.setFileInputFiles mechanism (page.setFileInput) to inject files into Twitter's file input. Includes proper file validation, graceful error handling for older extensions, and polling-based upload readiness detection instead of fixed delays. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
One concrete issue here: the new "wait for image upload" check is using the tweet button enabled state as the upload-complete signal, but That means So for a text+image tweet this can silently post the text without the images, or with only a partially finished upload, while still reporting success. I think the wait condition needs to watch an actual media-upload completion signal in the DOM, not the generic button enabled state. There also does not seem to be any test coverage for the new image path. The diff only changes |
Replace unreliable tweet-button-only polling with dual-condition check: wait for [data-testid="attachments"] with correct [role="group"] count AND button enabled. Increase timeout to 30s. Add 8 unit tests covering image upload flow, file validation, and error paths. Addresses PR jackwener#666 review feedback. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@Astro-Han Thanks for the review! Addressed both points:
|
Summary
--imagesoption totwitter postcommand, supporting up to 4 images (comma-separated paths)page.setFileInput()(CDPDOM.setFileInputFiles) to attach files to Twitter's file inputstatSyncchecks), graceful error handling for older extensions, and polling-based upload readiness detectionUsage
Test plan
npx tsc --noEmitpassesnpm testpasses (456 passed)🤖 Generated with Claude Code