Improve auth guidance for agents#7628
Conversation
|
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. This stack of pull requests is managed by Graphite. Learn more about stacking. |
39b6693 to
996ed11
Compare
996ed11 to
7ea8fe5
Compare
7ea8fe5 to
3b398b3
Compare
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>
3b398b3 to
28c742f
Compare
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.
*
|
|
/snapit |
|
🫰✨ 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-20260526094552Caution After installing, validate the version by running |

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?
docs/cli/auth.mdto document Shopify CLI's agent-friendly device auth flow, includingshopify auth status.shopify auth loginhelp and device auth output to tell agents to show the URL/code to the user and keep the command running.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.tspnpm --filter @shopify/cli-kit type-check && pnpm --filter @shopify/cli type-checkChecklist
patchfor bug fixes ·minorfor new features ·majorfor breaking changes) and added a changeset withpnpm changeset add