[Feature] Add shopify fetch command to download docs from shopify.dev#7766
Draft
nelsonwittwer wants to merge 7 commits into
Draft
[Feature] Add shopify fetch command to download docs from shopify.dev#7766nelsonwittwer wants to merge 7 commits into
shopify fetch command to download docs from shopify.dev#7766nelsonwittwer wants to merge 7 commits into
Conversation
nelsonwittwer
commented
Jun 9, 2026
nelsonwittwer
commented
Jun 9, 2026
Adds a top-level `fetch` command that downloads a shopify.dev page and prints it to stdout. It requests the Markdown representation by default (via the `Accept` header) and accepts a `--content-type` flag to override it. URLs are restricted to shopify.dev. This gives agents a way to pull instructional content from the centralized docs repo. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Rename command/class from `fetch`/`Fetch` to `fetch-doc`/`FetchDoc` (and the service to `fetchDocService`) to avoid an overly generic name. - Replace the hardcoded shopify.dev host check with an extensible `ALLOWED_HOSTS` array constant. - Regenerate oclif manifest, README, and shopify.dev docs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Distinguish the two docs commands by intent: - search: discovery — surface the most relevant pieces of content. - fetch-doc: retrieve a complete document verbatim, like a centrally-served skill an agent follows in its entirety. Each description cross-references the other so agents pick the right tool. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ery page Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
These commands previously rejected the CLI's standard global flags. Adding `globalFlags` makes them consistent with the rest of the CLI and lets `--verbose` surface the Monorail analytics payload for local verification. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- `--output <path>` (`-o`) writes the document to a file (creating any missing parent directories) instead of printing to stdout. - Remove the `--content-type` flag: fetch-doc now always requests the Markdown representation. Returning HTML is noisy and expensive and not a behavior we want to encourage. - Regenerate oclif manifest, README, and shopify.dev docs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
60b956c to
32e22ff
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@@ -47,6 +47,22 @@ 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;
+/**
+ * Reports whether the CLI already has stored credentials, without prompting the
+ * user, opening a browser, or making any network request.
+ *
+ * This is a passive, side-effect-free check: it reads the local session store and
+ * returns when at least one valid session is present. Unlike the
+ * functions, it never triggers a login flow and never logs
+ * the user out. Because it does not contact the network, it cannot tell whether the
+ * stored token is currently valid/unexpired — only that credentials exist locally.
+ *
+ * Intended for best-effort, opportunistic behaviour (for example, enriching
+ * telemetry only for users who are already logged in).
+ *
+ * @returns True if local credentials exist, false otherwise.
+ */
+export declare function sessionExists(): Promise<boolean>;
/**
* 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?
1. Agents need full contents of page
We have a blindspot for context for agents when the instructions are too long for skill files and/or when we want a centrally managed agent instructions. The app store requirements is a great example of this in action.
The entire contents of a page is needed to be shared with agents, not chunks like our existing search command supports.
2. Agents behavior needs to be tracked
CLI actions give us tracking for free with monorail events. We need to know how often agents are using pages that we ship (like this app store page) and how effective they are.
WHAT is this pull request doing?
Adds a top-level
shopify fetch-doc <url>command that downloads a shopify.dev page and prints it to stdout (pipe/capture friendly):Acceptheader; shopify.dev returnscontent-type: text/markdown), so agents get clean, parseable content instead of HTML.--output <path>flag (-o, envSHOPIFY_FLAG_OUTPUT) writes the document to a file instead of printing it to stdout, creating any missing parent directories.--verbose,--no-color).It mirrors the existing
searchcommand's structure (thin oclif command → service function → unit test) and is registered the same way inCOMMANDS, so it's automatically tracked by the CLI's analytics hooks like every other command — emitting anapp_cli3_command/1.26Monorail event withcommand: "fetch-doc". Generated artifacts (oclif manifest, README, shopify.dev docs interface + generated JSON) are regenerated and committed.This PR also clarifies the
searchcommand's description to distinguish the two docs commands by intent —searchfor chunked discovery (finding the relevant pieces) vs.fetch-docfor verbatim full-document retrieval (loading a whole instruction set, like a centrally-served skill) — and adds the shared global flags tosearchas well, so the two commands behave consistently.My 🎩
# Markdown (default) pnpm shopify fetch-doc https://shopify.dev/docs/api/shopify-cli# Save to a file instead of stdout (creates parent directories as needed) pnpm shopify fetch-doc https://shopify.dev/docs/api/shopify-cli --output docs/shopify-cli.mdAgent confirmation
lol agents will always tell you things work well, though they did tell me to add the
--outputoption and remove the--htmloption.Codex
Pi
Claude Code