Identify CLI via standard User-Agent header - #17
Merged
Conversation
Send `User-Agent: shop-cli/<version>` on every outbound request instead of a custom `X-Shopify-Agent-Source` header, applied via a small fetch wrapper. `--version` and the User-Agent share a single `CLI_VERSION` constant. Also gitignore a local AGENTS.md.
joerj123
force-pushed
the
use-user-agent-for-cli-identification
branch
from
June 12, 2026 08:42
51c3cad to
918ae36
Compare
…i-identification # Conflicts: # tests/catalog.test.ts
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.
What
Replaces the custom
X-Shopify-Agent-Source: shop-cliheader (added in #12) with a standardUser-Agenton every outbound request:Why
User-Agentis the standard, purpose-built way for a client to identify itself, so there's no need for a proprietary header. It's sent on every outbound request (catalog, checkout, auth, orders) via a smallwithUserAgent()fetch wrapper, and--versionand theUser-Agentnow share a singleCLI_VERSIONsource of truth.Identification/analytics only.
Changes
src/constants.tsAGENT_SOURCE/AGENT_SOURCE_HEADER; addCLI_VERSION+USER_AGENTsrc/http.tswithUserAgent()fetch wrappersrc/shop-client.tssrc/auth.tssrc/cli.ts--versionfromCLI_VERSIONskill/references/catalog-mcp.mdUser-Agentheader.gitignoreAGENTS.mdTesting
pnpm typecheck,pnpm test(80/80), andpnpm buildall pass.