Skip to content

Add non-mutating auth alias support#7859

Open
GeorgiZhelev wants to merge 3 commits into
Shopify:mainfrom
GeorgiZhelev:codex/theme-account-alias
Open

Add non-mutating auth alias support#7859
GeorgiZhelev wants to merge 3 commits into
Shopify:mainfrom
GeorgiZhelev:codex/theme-account-alias

Conversation

@GeorgiZhelev

@GeorgiZhelev GeorgiZhelev commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Added non-mutating account-session selection in cli-kit auth via an explicit sessionId option.
  • Exposed a public findSessionIdByAlias(alias) helper for resolving account aliases without changing the current global session.
  • Renamed the command flag from --alias to --auth-alias while keeping SHOPIFY_FLAG_AUTH_ALIAS.
  • Wired --auth-alias through Shopify theme commands and app commands that perform authenticated platform lookups.
  • Kept explicit alias-backed developer platform clients separate from the default client singletons so aliased auth does not contaminate the normal global session path.
  • Regenerated command docs, README, and oclif manifests.
  • Added patch changesets for @shopify/cli-kit, @shopify/theme, and @shopify/app.

Why

Theme and app commands previously relied on the globally selected CLI account session. This allows commands like:

shopify theme pull --store example.myshopify.com --auth-alias work
shopify app deploy --auth-alias work

without mutating the current global CLI session.

Validation

  • pnpm vitest run packages/cli-kit/src/private/node/session.test.ts packages/cli-kit/src/public/node/session.test.ts packages/theme/src/cli/utilities/theme-command.test.ts packages/theme/src/cli/utilities/theme-environment/dev-server-session.test.ts packages/theme/src/cli/services/metafields-pull.test.ts passed: 5 files, 98 tests.
  • pnpm vitest run packages/theme/src/cli/utilities/theme-command.test.ts packages/app/src/cli/utilities/auth-alias.test.ts packages/app/src/cli/services/app-context.test.ts packages/app/src/cli/commands/app/init.test.ts packages/app/src/cli/utilities/execute-command-helpers.test.ts packages/app/src/cli/utilities/developer-platform-client/app-management-client.test.ts packages/app/src/cli/utilities/developer-platform-client/partners-client.test.ts packages/app/src/cli/services/dev/processes/theme-app-extension.test.ts packages/app/src/cli/utilities/extensions/fetch-product-variant.test.ts packages/app/src/cli/services/function/common.test.ts passed: 10 files, 164 tests.
  • pnpm nx run app:type-check passed.
  • pnpm nx run theme:type-check passed.
  • pnpm nx run app:lint passed.
  • pnpm nx run theme:lint passed.
  • pnpm nx run cli-kit:lint passed.
  • pnpm refresh-manifests passed.
  • pnpm refresh-readme passed.
  • pnpm refresh-code-documentation passed.
  • pnpm build-dev-docs passed.
  • git diff --check passed.

Notes:

  • Sandboxed vitest runs that touch local-storage can fail on macOS preference-file permissions under ~/Library/Preferences; rerunning with filesystem access passed.

@GeorgiZhelev GeorgiZhelev force-pushed the codex/theme-account-alias branch from d4133d5 to 98c5dc8 Compare June 18, 2026 17:56
@GeorgiZhelev GeorgiZhelev marked this pull request as ready for review June 18, 2026 18:10
@GeorgiZhelev GeorgiZhelev requested review from a team as code owners June 18, 2026 18:10
@GeorgiZhelev GeorgiZhelev changed the title [codex] Add non-mutating theme account alias support Add non-mutating theme account alias support Jun 18, 2026
@kyaneva

kyaneva commented Jun 20, 2026

Copy link
Copy Markdown

Just tested this, works great! +1 on wanting this in the official CLI

@GeorgiZhelev

Copy link
Copy Markdown
Contributor Author

Hey @gonzaloriestra, would it be possible for someone to take a look please? I think it's a really useful feature but I hate using a custom build 😅

@gonzaloriestra

Copy link
Copy Markdown
Contributor

@GeorgiZhelev thanks for the contribution! I think it makes sense, but let me share it internally.

@gonzaloriestra

Copy link
Copy Markdown
Contributor

Ok, the team agrees! But we prefer to call it --auth-alias, which is more descriptive, and apply it as well to app commands.

Could you change it? Or I can take care of it in another PR. What do you prefer?

@GeorgiZhelev GeorgiZhelev changed the title Add non-mutating theme account alias support Add non-mutating auth alias support Jul 2, 2026
@GeorgiZhelev

Copy link
Copy Markdown
Contributor Author

@gonzaloriestra happy you guys like the change! I've renamed it and added it for the app commands too. I'm not quite sure about the merge conflicts though!

@gonzaloriestra

Copy link
Copy Markdown
Contributor

Great, thanks!

Regarding the conflicts, there were some recent changes in main in some files you touched, so you need to rebase and re-apply your changes there. Agents usually solve that very well.

Also, instead of adding the flags to all commands, you could add them to packages/app/src/cli/flags.ts and packages/theme/src/cli/flags.ts to simplify.

@GeorgiZhelev GeorgiZhelev force-pushed the codex/theme-account-alias branch from 6f575c7 to 1362890 Compare July 3, 2026 08:17
@GeorgiZhelev

Copy link
Copy Markdown
Contributor Author

@gonzaloriestra Done for both :)

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.

3 participants