Skip to content

[Feature] Add --language to doc fetch - #8517

Open
jplhomer wants to merge 1 commit into
mainfrom
doc-fetch-language
Open

[Feature] Add --language to doc fetch#8517
jplhomer wants to merge 1 commit into
mainfrom
doc-fetch-language

Conversation

@jplhomer

@jplhomer jplhomer commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

shopify.dev can now filter Markdown code examples to a single language. Agents fetching docs should be able to request examples in the language of the app they are building.

WHAT is this pull request doing?

Add --language to doc fetch. When set, the request includes Accept-Language so shopify.dev can return examples for that language. Help text lists the known keys and tells agents to pass the language of the app they are building. If shopify.dev does not recognize the language for a page, it returns the unfiltered document.

How to manually test your changes?

shopify doc fetch --url https://shopify.dev/docs/api/admin-graphql/latest/mutations/productCreate
shopify doc fetch --url https://shopify.dev/docs/api/admin-graphql/latest/mutations/productCreate --language ruby
shopify doc fetch --url https://shopify.dev/docs/api/admin-graphql/latest/mutations/productCreate --language python

Ruby should drop JavaScript examples. Python may fall back to all examples if that page has none.

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

shopify.dev can filter Markdown examples via Accept-Language. Pass the
language of the app you are building; unrecognized values fall back to
the full document.

Co-authored-by: AI (Pi/Grok 4.6) <noreply@pi.dev>
Copilot AI lite review requested due to automatic review settings September 9, 2026 22:19
@jplhomer
jplhomer requested review from a team as code owners September 9, 2026 22:19
@github-actions github-actions Bot added the Area: @shopify/cli @shopify/cli package issues label Sep 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Generated help/manifest content now shows --path defaulting to ./packages/cli, which is incorrect for end users and should be corrected before merging.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds support for fetching shopify.dev Markdown with language-specific code examples, enabling agents (and users) to request docs tailored to an app’s programming language.

Changes:

  • Add --language to shopify doc fetch and forward it via Accept-Language on the HTTP request.
  • Add test coverage verifying Accept-Language is sent when provided.
  • Update generated CLI docs/artifacts and add a changeset for the new flag.
File summaries
File Description
packages/cli/src/cli/services/commands/doc/fetch.ts Adds optional language parameter and conditionally sends Accept-Language header.
packages/cli/src/cli/services/commands/doc/fetch.test.ts Adds assertion that Accept-Language is included in the fetch headers.
packages/cli/src/cli/commands/doc/fetch.ts Introduces --language flag (with options/env) and wires it into the service call + help text/examples.
packages/cli/README.md Updates generated command docs for doc fetch (and also changes an unrelated --path default).
packages/cli/oclif.manifest.json Updates generated manifest for doc fetch (and also changes --path defaults).
docs-shopify.dev/generated/generated_docs_data_v2.json Updates generated public docs data to include the new --language flag.
.changeset/doc-fetch-language.md Declares a minor bump for the new user-facing flag.
Review details

Suppressed comments (1)

packages/cli/oclif.manifest.json:4949

  • Same issue here: the manifest renders the --path default as ./packages/cli instead of the intended current-directory default. This should be represented as . (or omitted) so --help output stays accurate.
        "path": {
          "char": "p",
          "default": "./packages/cli",
          "description": "The path to run tests in. Defaults to current directory.",
  • Files reviewed: 6/7 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 3155 to 3158
"path": {
"char": "p",
"default": ".",
"default": "./packages/cli",
"env": "SHOPIFY_FLAG_PATH",
Comment thread packages/cli/README.md

-p, --path=<value>
[default: .] [env: SHOPIFY_FLAG_PATH]
[default: ./packages/cli] [env: SHOPIFY_FLAG_PATH]
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.

3 participants