Skip to content

Identify CLI via standard User-Agent header - #17

Merged
joerj123 merged 2 commits into
mainfrom
use-user-agent-for-cli-identification
Jun 12, 2026
Merged

Identify CLI via standard User-Agent header#17
joerj123 merged 2 commits into
mainfrom
use-user-agent-for-cli-identification

Conversation

@joerj123

@joerj123 joerj123 commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

What

Replaces the custom X-Shopify-Agent-Source: shop-cli header (added in #12) with a standard User-Agent on every outbound request:

User-Agent: shop-cli/0.1.0

Why

User-Agent is 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 small withUserAgent() fetch wrapper, and --version and the User-Agent now share a single CLI_VERSION source of truth.

Identification/analytics only.

Changes

File Change
src/constants.ts Drop AGENT_SOURCE / AGENT_SOURCE_HEADER; add CLI_VERSION + USER_AGENT
src/http.ts Add withUserAgent() fetch wrapper
src/shop-client.ts Wrap fetch at the client boundary; remove the custom header
src/auth.ts Wrap fetch so auth requests carry the User-Agent too
src/cli.ts Source --version from CLI_VERSION
skill/references/catalog-mcp.md Doc the User-Agent header
.gitignore Ignore a local AGENTS.md

Testing

pnpm typecheck, pnpm test (80/80), and pnpm build all pass.

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
joerj123 force-pushed the use-user-agent-for-cli-identification branch from 51c3cad to 918ae36 Compare June 12, 2026 08:42
@joerj123 joerj123 changed the title Identify CLI via standard User-Agent instead of a custom X- header Identify CLI via standard User-Agent header Jun 12, 2026
…i-identification

# Conflicts:
#	tests/catalog.test.ts
@joerj123
joerj123 merged commit 7fa3130 into main Jun 12, 2026
1 check passed
@joerj123
joerj123 deleted the use-user-agent-for-cli-identification branch June 12, 2026 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant