Improve auth guidance for agents#7628
Draft
gonzaloriestra wants to merge 2 commits into
Draft
Conversation
Contributor
Author
|
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
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?
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