Add auth-alias flag#8026
Open
isaacroldan wants to merge 2 commits into
Open
Conversation
34a65dc to
f418427
Compare
Assisted-By: devx/782ef931-ac0a-4cc4-bff1-a2511c379664
1f925f4 to
6c6cc2a
Compare
Contributor
Author
|
/snapit |
Contributor
|
🫰✨ Thanks @isaacroldan! Your snapshot has been published to npm. Test the snapshot by installing your package globally: pnpm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20260708081954Caution After installing, validate the version by running |
Assisted-By: devx/782ef931-ac0a-4cc4-bff1-a2511c379664
Contributor
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/private/node/session.d.ts@@ -90,6 +90,7 @@ export declare function setLastSeenUserIdAfterAuth(id: string): void;
*/
export declare function getLastSeenAuthMethod(): Promise<AuthMethod>;
export declare function setLastSeenAuthMethod(method: AuthMethod): void;
+export declare function setCommandSessionId(sessionId: string | undefined): void;
export interface EnsureAuthenticatedAdditionalOptions {
noPrompt?: boolean;
forceRefresh?: boolean;
packages/cli-kit/dist/public/node/base-command.d.ts@@ -16,6 +16,7 @@ declare abstract class BaseCommand extends Command {
protected parse<TFlags extends FlagOutput & {
path?: string;
verbose?: boolean;
+ 'auth-alias'?: string;
}, TGlobalFlags extends FlagOutput, TArgs extends ArgOutput>(options?: Input<TFlags, TGlobalFlags, TArgs>, argv?: string[]): Promise<ParserOutput<TFlags, TGlobalFlags, TArgs> & {
argv: string[];
}>;
packages/cli-kit/dist/public/node/cli.d.ts@@ -39,6 +39,9 @@ export declare const globalFlags: {
export declare const jsonFlag: {
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
};
+export declare const authAliasFlag: {
+ 'auth-alias': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
+};
/**
* Builds a flag that only accepts a valid port number. The flag parses its
* value as an integer and rejects anything that isn't a whole number between 1 and
packages/cli-kit/dist/public/node/session.d.ts@@ -22,6 +22,19 @@ export type AccountInfo = UserAccountInfo | ServiceAccountInfo | UnknownAccountI
* @param userId - User identifier to report on the command analytics event.
*/
export declare function setLastSeenUserId(userId: string): void;
+/**
+ * Finds a stored Shopify account session by alias without changing the current session.
+ *
+ * @param alias - The account alias to find.
+ * @returns The matching session ID, or undefined if no session matches.
+ */
+export declare function findSessionIdByAlias(alias: string): Promise<string | undefined>;
+/**
+ * Selects a stored Shopify account session by alias for the current command process.
+ *
+ * @param alias - The account alias to select. Passing undefined clears the command selection.
+ */
+export declare function setCurrentSessionAlias(alias?: string): Promise<void>;
interface UserAccountInfo {
type: 'UserAccount';
email: string;
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

WHY are these changes introduced?
App and theme workflows need a way to run commands with a stored Shopify account alias without switching the user's persisted current CLI session.
WHAT is this pull request doing?
authAliasFlagin cli-kit.AppCommand,ThemeCommand, andorganization listonly.--auth-aliascentrally inBaseCommand, resolves the alias to a command-scoped session, and uses that session during authentication without mutating the current session.How to test your changes?
Manual smoke:
Post-release steps
None.