Add shopify doc fetch command to download MD doc from shopify.dev#7766
Merged
Conversation
nelsonwittwer
commented
Jun 9, 2026
nelsonwittwer
commented
Jun 9, 2026
60b956c to
32e22ff
Compare
shopify fetch command to download docs from shopify.devdoc fetch command (download docs from shopify.dev)
doc fetch command (download docs from shopify.dev)shopify doc fetch command to download MD doc from shopify.dev
85aa853 to
1a95946
Compare
d8e0bc6 to
45f9b37
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.
*
|
durga256
approved these changes
Jun 22, 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>
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>
Identifies the CLI as the calling surface to shopify.dev so traffic originating from the CLI can be attributed as such. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Per the CLI design guidelines: flags make intent explicit, don't rely on order, and shouldn't be shortened — so the URL is now --url and the -o alias for --output is dropped. Regenerated manifest + README. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fc084c2 to
99313e9
Compare
Assisted-By: devx/214c76e8-6ac0-48f1-bff5-0ef68c95d938
99313e9 to
fbeae30
Compare
isaacroldan
approved these changes
Jun 23, 2026
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 <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 <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.🎩 Testing instructions
doc fetchhits a public endpoint on shopify.dev — no auth, no app, no login required. It just needs network access.Run commands from the repo root via
node packages/cli/bin/dev.js …:1. Fetch a real page → prints Markdown to stdout
2.
--outputwrites to a file (creating missing parent dirs)node packages/cli/bin/dev.js doc fetch --url https://shopify.dev/docs/api/shopify-cli --output /tmp/doc-fetch/cli.md head -5 /tmp/doc-fetch/cli.md # → "Saved …" message, and the file exists with the Markdown content3. Disallowed host → rejected before any network call
node packages/cli/bin/dev.js doc fetch --url https://example.com/whatever # → "Only documents from the following hosts can be fetched: shopify.dev."4. Malformed URL → rejected
node packages/cli/bin/dev.js doc fetch --url not-a-url # → "Invalid URL: not-a-url"5. Non-ok response surfaces status
node packages/cli/bin/dev.js doc fetch --url https://shopify.dev/this-page-does-not-exist-xyz # → "Failed to fetch …: 404 Not Found" (exit non-zero)6. Required arg + help
Inspecting the Monorail analytics payload
This branch is rebased on the app-context telemetry PR (#7771), so every command emits a command-analytics event. To see exactly what would be sent to Monorail — without sending it — set two env vars:
SHOPIFY_CLI_NO_ANALYTICS=1— dump the payload via debug logging instead of POSTing it.SHOPIFY_FLAG_VERBOSE=1— raise the log level so the debug line prints.To confirm the inherited app-context hook, run the same command from inside an app directory while logged in — the payload then also carries app-level identifiers (
api_key,project_type,app_*). Run it from a non-app directory and those fields are absent.Notes
@shopify/cli: minor.doctopic (commands/doc/fetch.ts, registered asdoc:fetch); adds adoctopic description.telemetry-app-context-everywhere(Capture app context in analytics for every command run inside an app #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