Skip to content

Add auth status command#7629

Draft
gonzaloriestra wants to merge 4 commits into
mainfrom
agent-auth/add-status
Draft

Add auth status command#7629
gonzaloriestra wants to merge 4 commits into
mainfrom
agent-auth/add-status

Conversation

@gonzaloriestra
Copy link
Copy Markdown
Contributor

@gonzaloriestra gonzaloriestra commented May 25, 2026

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?

  • Adds shopify auth status with human-readable output and --json for stable machine-readable status.
  • Adds a cli-kit getAuthStatus() helper that checks stored sessions without starting a login flow.
  • Updates generated command docs, the command snapshot, and tests.

How to test your changes?

shopify auth status

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — I've identified the correct bump type (patch for bug fixes · minor for new features · major for breaking changes) and added a changeset with pnpm changeset add

Copy link
Copy Markdown
Contributor Author

gonzaloriestra commented May 25, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label May 25, 2026
@gonzaloriestra gonzaloriestra force-pushed the agent-auth/add-status branch from 1a625fd to 4cfa0c2 Compare May 25, 2026 11:54
@github-actions github-actions Bot added Area: @shopify/cli @shopify/cli package issues and removed no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. labels May 25, 2026
@gonzaloriestra gonzaloriestra force-pushed the agent-auth/improve-guidance branch from 39b6693 to 996ed11 Compare May 25, 2026 12:05
@gonzaloriestra gonzaloriestra force-pushed the agent-auth/add-status branch from 4cfa0c2 to 661084f Compare May 25, 2026 12:07
@gonzaloriestra
Copy link
Copy Markdown
Contributor Author

/snapit

@github-actions
Copy link
Copy Markdown
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-20260525120835

Caution

After installing, validate the version by running shopify version in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

gonzaloriestra and others added 2 commits May 25, 2026 15:47
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>
@gonzaloriestra gonzaloriestra changed the base branch from agent-auth/improve-guidance to graphite-base/7629 May 25, 2026 13:48
@gonzaloriestra gonzaloriestra force-pushed the agent-auth/add-status branch from 661084f to f700b48 Compare May 25, 2026 13:48
@gonzaloriestra gonzaloriestra changed the base branch from graphite-base/7629 to main May 25, 2026 13:48
gonzaloriestra and others added 2 commits May 25, 2026 15:54
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions
Copy link
Copy Markdown
Contributor

Differences in type declarations

We 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:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/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.
  *

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

Labels

Area: @shopify/cli @shopify/cli package issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant