Add doc fetch command (download docs from shopify.dev)#7766
Draft
nelsonwittwer wants to merge 8 commits into
Draft
Add doc fetch command (download docs from shopify.dev)#7766nelsonwittwer wants to merge 8 commits into
doc fetch command (download docs from shopify.dev)#7766nelsonwittwer wants to merge 8 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
Per the doc-namespace plan, documentation commands live under a `doc` topic. Rename `fetch-doc` → `doc fetch`: - commands/doc/fetch.ts (class DocFetch), services/commands/doc/fetch.ts (docFetchService), and the colocated test. - Register as `doc:fetch`; add a `doc` topic description. - Update cross-references (`search` now points to `doc fetch`; `doc fetch` points to `doc search`). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
shopify fetch command to download docs from shopify.devdoc fetch command (download docs from shopify.dev)
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/common/url.d.ts@@ -12,20 +12,4 @@ export declare function isValidURL(url: string): boolean;
* @param url - The string to parse into a URL.
* @returns A URL object if the parsing is successful, undefined otherwise.
*/
-export declare function safeParseURL(url: string): URL | undefined;
-/**
- * Extracts the lowercased hostname from a URL-shaped string. Tolerates
- * bare hosts (without a scheme) and inputs that come back from APIs as
- * either or .
- *
- * @param value - A URL or bare host string, possibly null/undefined.
- * @returns The lowercased hostname, or undefined when the input is empty.
- */
-export declare function extractHost(value: string | null | undefined): string | undefined;
-/**
- * Extracts the subdomain handle from a URL or host.
- *
- * @param value - A URL or host string, possibly null/undefined.
- * @returns The myshopify subdomain handle, or undefined when the input isn't a URL.
- */
-export declare function extractMyshopifyHandle(value: string | null | undefined): string | undefined;
\ No newline at end of file
+export declare function safeParseURL(url: string): URL | undefined;
\ No newline at end of file
packages/cli-kit/dist/public/node/metadata.d.ts@@ -38,7 +38,6 @@ type CmdFieldsFromMonorail = PickByPrefix<MonorailEventPublic, 'cmd_all_'> & Pic
declare const coreData: RuntimeMetadataManager<CmdFieldsFromMonorail, {
commandStartOptions: {
startTime: number;
- endTime?: number;
startCommand: string;
startTopic?: string;
startArgs: string[];
@@ -59,7 +58,6 @@ declare const coreData: RuntimeMetadataManager<CmdFieldsFromMonorail, {
export declare const getAllPublicMetadata: () => Partial<CmdFieldsFromMonorail>, getAllSensitiveMetadata: () => Partial<{
commandStartOptions: {
startTime: number;
- endTime?: number;
startCommand: string;
startTopic?: string;
startArgs: string[];
@@ -79,7 +77,6 @@ export declare const getAllPublicMetadata: () => Partial<CmdFieldsFromMonorail>,
}, "store_", never>>, addPublicMetadata: (getData: ProvideMetadata<CmdFieldsFromMonorail>, onError?: MetadataErrorHandling) => Promise<void>, addSensitiveMetadata: (getData: ProvideMetadata<{
commandStartOptions: {
startTime: number;
- endTime?: number;
startCommand: string;
startTopic?: string;
startArgs: string[];
packages/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.
What
Adds
shopify doc fetch <url>, which downloads a complete document from shopify.dev and prints it to stdout (or writes it to a file with--output).This is part of the new
docnamespace for documentation tooling — the "full document" half. The "discovery" half isdoc search(#7770).Why
Every page on shopify.dev has a Markdown representation.
doc fetchrequests that representation, giving agents (and scripts) a clean, verbatim way to pull instructional content from the centralized docs — for example, a set of instructions an agent follows like a centrally-served skill.Details
shopify doc fetch <url>— requests the Markdown version of the page.--output <path>(-o) — write to a file instead of stdout.shopify.dev(and subdomains) URLs are allowed; malformed/disallowed URLs and non-ok responses throw before any output.Notes
@shopify/cli: minor.doctopic (commands/doc/fetch.ts, registered asdoc:fetch); adds adoctopic description.telemetry-app-context-everywhere(Capture app context (api_key/project_type) in analytics for every command #7771), so it inherits the app-context telemetry hook automatically.Related
doc searchcommand (JSON documentation search) #7770 —doc search(JSON documentation search).search#7778 — deprecates the old browsersearchcommand, pointing users todoc search.🤖 Generated with Claude Code