Add auth status command#7629
Draft
gonzaloriestra wants to merge 4 commits into
Draft
Conversation
4 tasks
1a625fd to
4cfa0c2
Compare
39b6693 to
996ed11
Compare
4cfa0c2 to
661084f
Compare
Contributor
Author
|
/snapit |
Contributor
|
🫰✨ Thanks @gonzaloriestra! 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-20260525120835Caution After installing, validate the version by running |
Expose a JSON-capable auth status command so agents can check whether Shopify CLI has a usable account session before starting authenticated workflows.
Co-authored-by: Cursor <cursoragent@cursor.com>
661084f to
f700b48
Compare
996ed11 to
c422f35
Compare
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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/public/node/session.d.ts@@ -33,6 +33,21 @@ interface ServiceAccountInfo {
interface UnknownAccountInfo {
type: 'UnknownAccount';
}
+export type AuthStatusName = 'authenticated' | 'needs_refresh' | 'not_authenticated' | 'invalid';
+export interface AuthStatus {
+ status: AuthStatusName;
+ authenticated: boolean;
+ account?: {
+ userId: string;
+ alias?: string;
+ };
+ identityFqdn?: string;
+ expiresAt?: string;
+ agentGuidance: {
+ instruction: string;
+ nextCommand?: string;
+ };
+}
/**
* Type guard to check if an account is a UserAccount.
*
@@ -47,6 +62,12 @@ export declare function isUserAccount(account: AccountInfo): account is UserAcco
* @returns True if the account is a ServiceAccount.
*/
export declare function isServiceAccount(account: AccountInfo): account is ServiceAccountInfo;
+/**
+ * Returns the current Shopify CLI authentication status without starting a login flow.
+ *
+ * @returns The current authentication status.
+ */
+export declare function getAuthStatus(): Promise<AuthStatus>;
/**
* Ensure that we have a valid session with no particular scopes.
*
|
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?
Agents need a deterministic way to check whether Shopify CLI already has a usable Shopify account session before starting workflows that require auth. This PR adds that primitive first so follow-up guidance can point agents at a stable command.
WHAT is this pull request doing?
shopify auth statuswith human-readable output and--jsonfor stable machine-readable status.getAuthStatus()helper that checks stored sessions without starting a login flow.How to test your changes?
shopify auth statusChecklist
patchfor bug fixes ·minorfor new features ·majorfor breaking changes) and added a changeset withpnpm changeset add