[eas-cli] Add account:avatar:set command - #4073
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
|
Subscribed to pull request
Generated by CodeMention Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4073 +/- ##
==========================================
+ Coverage 61.54% 61.58% +0.04%
==========================================
Files 980 982 +2
Lines 43952 44008 +56
Branches 9226 9233 +7
==========================================
+ Hits 27047 27097 +50
- Misses 15457 15463 +6
Partials 1448 1448 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🤖 AI code reviewDecision: Approve No findings reported by any specialist reviewer (correctness, consistency, security). The PR is clean. No findings. This review is advisory — it never blocks a merge and never auto-approves. |
|
✅ Thank you for adding the changelog entry! |
Why
Follow-up to #4068, which added
eas project:icon:set. Setting an account avatar (which for a personal account is your user avatar) has the same problem: it currently requires going through the website. The GraphQL API already supports avatar uploads via account-scoped upload sessions, so this exposes it in the CLI aseas account:avatar:set PATH [ACCOUNT_NAME].There is no user-scoped upload session — a user's picture is their personal account's profile image (the website's personal settings page uploads to
user.primaryAccount.id), so a single account-scoped command covers both users and organizations.How
account:avatar:set: validates the image (exists, PNG/JPEG, ≤ 10 MB), resolves the target account the same wayaccount:usagedoes (explicitACCOUNT_NAMEargument → the only account → interactive prompt; errors in--non-interactivemode without a name), uploads via the existing account-scoped upload session with typePROFILE_IMAGE_UPLOAD, then pollsaccount.byId.profileImageUrl(2s interval, 90s timeout) until it changes — avatars are processed asynchronously server-side (resized to 1024×1024, non-square images center-cropped), same as project icons. On success it links to the account settings page.project:icon:setintosrc/utils/profileImages.ts(validateProfileImageAsync,pollForProfileImageChangeAsync) and refactored the project command to use it.AccountQuery.byIdProfileImageUrlAsync, a network-only query used for the before/after polling.uploadAccountScopedFileAtPathToGCSAsync's progress handler optional (avatars are small enough not to need one).Test Plan
src/commands/account/avatar/__tests__/set.test.tscovering account resolution (explicit argument, single account, interactive prompt), the non-interactive error, the no-access error, and missing-file validation. The 6 existingproject:icon:settests still pass against the shared helpers.yarn typecheck,yarn lint, andyarn fmt:checkpass; README regenerated viaoclif readme.🤖 Generated with Claude Code