Skip to content

Improve auth guidance for agents#7628

Draft
gonzaloriestra wants to merge 2 commits into
agent-auth/add-statusfrom
agent-auth/improve-guidance
Draft

Improve auth guidance for agents#7628
gonzaloriestra wants to merge 2 commits into
agent-auth/add-statusfrom
agent-auth/improve-guidance

Conversation

@gonzaloriestra
Copy link
Copy Markdown
Contributor

@gonzaloriestra gonzaloriestra commented May 25, 2026

WHY are these changes introduced?

After adding shopify auth status, agents should have clear inline and documentation guidance for using the existing device auth flow. This PR builds on the status command by documenting the recommended sequence and making login output easier for agents to relay to users.

WHAT is this pull request doing?

  • Adds docs/cli/auth.md to document Shopify CLI's agent-friendly device auth flow, including shopify auth status.
  • Updates shopify auth login help and device auth output to tell agents to show the URL/code to the user and keep the command running.
  • Adds regression coverage for the new device auth guidance.

How to test your changes?

  • pnpm vitest run packages/cli-kit/src/private/node/session/device-authorization.test.ts packages/cli/src/cli/commands/auth/login.test.ts packages/cli-kit/src/public/node/session-auth-status.test.ts packages/cli/src/cli/commands/auth/status.test.ts
  • pnpm --filter @shopify/cli-kit type-check && pnpm --filter @shopify/cli type-check

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

@gonzaloriestra gonzaloriestra mentioned this pull request May 25, 2026
4 tasks
Copy link
Copy Markdown
Contributor Author

gonzaloriestra commented May 25, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

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

@github-actions github-actions Bot added no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. 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
@github-actions github-actions Bot added no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. and removed Area: @shopify/cli @shopify/cli package issues labels May 25, 2026
@gonzaloriestra gonzaloriestra changed the base branch from main to graphite-base/7628 May 25, 2026 13:48
@gonzaloriestra gonzaloriestra force-pushed the agent-auth/improve-guidance branch from 996ed11 to 7ea8fe5 Compare May 25, 2026 13:48
@gonzaloriestra gonzaloriestra changed the base branch from graphite-base/7628 to agent-auth/add-status May 25, 2026 13:48
@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 7ea8fe5 to 3b398b3 Compare May 25, 2026 13:55
gonzaloriestra and others added 2 commits May 25, 2026 16:30
Clarify device-auth instructions in command output and docs so agents can guide users through browser login while keeping the CLI process running.
Co-authored-by: Cursor <cursoragent@cursor.com>
@gonzaloriestra gonzaloriestra force-pushed the agent-auth/improve-guidance branch from 3b398b3 to 28c742f Compare May 25, 2026 14:31
@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.
  *

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-20260526094552

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.

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