Skip to content

[eas-cli] Add account:avatar:set command - #4073

Open
brentvatne wants to merge 3 commits into
mainfrom
@brent/account-profile-image
Open

[eas-cli] Add account:avatar:set command#4073
brentvatne wants to merge 3 commits into
mainfrom
@brent/account-profile-image

Conversation

@brentvatne

Copy link
Copy Markdown
Member

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 as eas 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

  • New command account:avatar:set: validates the image (exists, PNG/JPEG, ≤ 10 MB), resolves the target account the same way account:usage does (explicit ACCOUNT_NAME argument → the only account → interactive prompt; errors in --non-interactive mode without a name), uploads via the existing account-scoped upload session with type PROFILE_IMAGE_UPLOAD, then polls account.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.
  • Extracted the image validation and polling logic shared with project:icon:set into src/utils/profileImages.ts (validateProfileImageAsync, pollForProfileImageChangeAsync) and refactored the project command to use it.
  • Added AccountQuery.byIdProfileImageUrlAsync, a network-only query used for the before/after polling.
  • Made uploadAccountScopedFileAtPathToGCSAsync's progress handler optional (avatars are small enough not to need one).

Test Plan

  • 6 new unit tests in src/commands/account/avatar/__tests__/set.test.ts covering account resolution (explicit argument, single account, interactive prompt), the non-interactive error, the no-access error, and missing-file validation. The 6 existing project:icon:set tests still pass against the shared helpers.
  • Tried it for real on https://expo.dev/accounts/brent-org/settings with a random non-square (600×400) image from the web — the avatar uploaded, was center-cropped, and appeared in the account settings.
  • yarn typecheck, yarn lint, and yarn fmt:check pass; README regenerated via oclif readme.

🤖 Generated with Claude Code

@brentvatne brentvatne added the ai-review Commits pushed to PRs with this label be automatically reviewed. label Jul 24, 2026

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions

Copy link
Copy Markdown

Subscribed to pull request

File Patterns Mentions
packages/eas-cli/** @douglowder

Generated by CodeMention

Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead.

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.68293% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.58%. Comparing base (adab984) to head (7cb4981).

Files with missing lines Patch % Lines
...ckages/eas-cli/src/graphql/queries/AccountQuery.ts 0.00% 3 Missing ⚠️
...ackages/eas-cli/src/commands/account/avatar/set.ts 95.84% 2 Missing ⚠️
packages/eas-cli/src/uploads.ts 0.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown

🤖 AI code review

Decision: 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.

@github-actions

Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Commits pushed to PRs with this label be automatically reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant